]> granicus.if.org Git - clang/commitdiff
When we see an out-of-line definition of a member class template that
authorDouglas Gregor <dgregor@apple.com>
Tue, 1 Nov 2011 21:35:16 +0000 (21:35 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 1 Nov 2011 21:35:16 +0000 (21:35 +0000)
does not match any declaration in the class (or class template), be
sure to mark it as invalid. Fixes PR10924 / <rdar://problem/10119422>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143504 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaTemplate.cpp
test/SemaTemplate/nested-template.cpp

index de0193c61d417b7f179909c6bc5d8b28a6e787f4..41c62550e883ed5cd850ce70f61c72e939eab60f 100644 (file)
@@ -989,9 +989,11 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
     // 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 =
index ab647aa22675783dcf956fba1ca0919c23412bbb..7849bae4d571855eff1588eff9f785364c0ef642 100644 (file)
@@ -142,3 +142,16 @@ namespace PR10896 {
     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>'}}
+  {
+  };
+}