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>.

llvm-svn: 143504
This commit is contained in:
Douglas Gregor 2011-11-01 21:35:16 +00:00
parent 8188c8a1f3
commit fe0055e6c8
2 changed files with 16 additions and 1 deletions

View 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 =

View 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>'}}
{
};
}