[cfe-commits] r80396 - in /cfe/trunk: lib/Sema/SemaTemplate.cpp test/SemaTemplate/instantiate-member-template.cpp

Douglas Gregor dgregor at apple.com
Fri Aug 28 14:41:19 PDT 2009


Author: dgregor
Date: Fri Aug 28 16:41:19 2009
New Revision: 80396

URL: http://llvm.org/viewvc/llvm-project?rev=80396&view=rev
Log:
Test instantiation of static data members that live within nested
member templates.

Modified:
    cfe/trunk/lib/Sema/SemaTemplate.cpp
    cfe/trunk/test/SemaTemplate/instantiate-member-template.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=80396&r1=80395&r2=80396&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Fri Aug 28 16:41:19 2009
@@ -808,9 +808,6 @@
                                               const CXXScopeSpec &SS,
                                           TemplateParameterList **ParamLists,
                                               unsigned NumParamLists) {
-  // FIXME: This routine will need a lot more testing once we have support for
-  // member templates.
-  
   // Find the template-ids that occur within the nested-name-specifier. These
   // template-ids will match up with the template parameter lists.
   llvm::SmallVector<const TemplateSpecializationType *, 4>

Modified: cfe/trunk/test/SemaTemplate/instantiate-member-template.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiate-member-template.cpp?rev=80396&r1=80395&r2=80396&view=diff

==============================================================================
--- cfe/trunk/test/SemaTemplate/instantiate-member-template.cpp (original)
+++ cfe/trunk/test/SemaTemplate/instantiate-member-template.cpp Fri Aug 28 16:41:19 2009
@@ -63,10 +63,16 @@
 struct X1<T>::Inner4 {
   template<typename V>
   V f2(T t, U u, V);
+  
+  static U value;
 };
 
 template<typename T>
 template<typename U>
+U X1<T>::Inner4<U>::value; // expected-error{{reference variable}}
+
+template<typename T>
+template<typename U>
 template<typename V>
 V X1<T>::Inner4<U>::f2(T t, U u, V) {
   return t + u; // expected-error{{incompatible type}}
@@ -93,4 +99,7 @@
   
   X1<int*>::Inner4<int> id4;
   id4.f2(ip, i, dp); // expected-note{{instantiation}}
+  
+  X1<int*>::Inner4<int>::value = 17;
+  i = X1<int*>::Inner4<int&>::value; // expected-note{{instantiation}}
 }





More information about the cfe-commits mailing list