[cfe-commits] r143504 - in /cfe/trunk: lib/Sema/SemaTemplate.cpp test/SemaTemplate/nested-template.cpp

Douglas Gregor dgregor at apple.com
Tue Nov 1 14:35:17 PDT 2011


Author: dgregor
Date: Tue Nov  1 16:35:16 2011
New Revision: 143504

URL: http://llvm.org/viewvc/llvm-project?rev=143504&view=rev
Log:
When we see an out-of-line definition of a member class template that
does not match any declaration in the class (or class template), be
sure to mark it as invalid. Fixes PR10924 / <rdar://problem/10119422>.

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

Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=143504&r1=143503&r2=143504&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Tue Nov  1 16:35:16 2011
@@ -989,9 +989,11 @@
     // If the name of the template was qualified, we must be defining the
     // template out-of-line.
     if (!SS.isInvalid() && !Invalid && !PrevClassTemplate &&
-        !(TUK == TUK_Friend && CurContext->isDependentContext()))
+        !(TUK == TUK_Friend && CurContext->isDependentContext())) {
       Diag(NameLoc, diag::err_member_def_does_not_match)
         << Name << SemanticContext << SS.getRange();
+      Invalid = true;
+    }
   }
 
   CXXRecordDecl *NewClass =

Modified: cfe/trunk/test/SemaTemplate/nested-template.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/nested-template.cpp?rev=143504&r1=143503&r2=143504&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/nested-template.cpp (original)
+++ cfe/trunk/test/SemaTemplate/nested-template.cpp Tue Nov  1 16:35:16 2011
@@ -142,3 +142,16 @@
     f.foo();
   }
 }
+
+namespace PR10924 {
+  template< class Topology, class ctype >
+  struct ReferenceElement
+  {
+  };
+
+  template< class Topology, class ctype >
+  template< int codim >
+  class ReferenceElement< Topology, ctype > :: BaryCenterArray // expected-error{{out-of-line definition of 'BaryCenterArray' does not match any declaration in 'ReferenceElement<Topology, ctype>'}}
+  {
+  };
+}





More information about the cfe-commits mailing list