improve some error recovery with explicit template instantiation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72484
91177308-0d34-0410-b5e6-
96231b3b80d8
if (PrevDecl == 0) {
Diag(NameLoc, diag::err_not_tag_in_scope) << Name << SS.getRange();
Name = 0;
+ Invalid = true;
goto CreateNewDecl;
}
} else if (Name) {
New->setLexicalDeclContext(CurContext);
// Set the access specifier.
- SetMemberAccessSpecifier(New, PrevDecl, AS);
+ if (!Invalid)
+ SetMemberAccessSpecifier(New, PrevDecl, AS);
if (TK == TK_Definition)
New->startDefinition();
return true;
}
+ if (Tag->isInvalidDecl())
+ return true;
+
CXXRecordDecl *Record = cast<CXXRecordDecl>(Tag);
CXXRecordDecl *Pattern = Record->getInstantiatedFromMemberClass();
if (!Pattern) {
-// RUN: clang-cc -fsyntax-only %s
+// RUN: clang-cc -fsyntax-only -verify %s
namespace N {
struct Outer {
static enum K1 { K1Val = sizeof(T) } Kind1;
static enum { K2Val = sizeof(T)*2 } Kind2;
+ enum { K3Val = sizeof(T)*2 } Kind3;
void foo() {
K1 k1 = K1Val;
Kind1 = K1Val;
Outer::Inner::InnerTemplate<type>::VeryInner::Kind2 = K2Val;
+ Kind3 = K3Val;
}
+
+ struct UeberInner {
+ void bar() {
+ K1 k1 = K1Val;
+ Kind1 = K1Val;
+ Outer::Inner::InnerTemplate<type>::VeryInner::Kind2 = K2Val;
+ }
+ };
};
};
};
typedef int INT;
template struct N::Outer::Inner::InnerTemplate<INT>::VeryInner;
+template struct N::Outer::Inner::InnerTemplate<INT>::UeberInner; // expected-error{{'UeberInner' does not name a tag member}}