Our error recovery path may have made the class anonymous, and that has a pretty
disastrous impact on any attempt to parse a class body containing constructors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169374
91177308-0d34-0410-b5e6-
96231b3b80d8
AddPushedVisibilityAttribute(New);
OwnedDecl = true;
- return New;
+ // In C++, don't return an invalid declaration. We can't recover well from
+ // the cases where we make the type anonymous.
+ return (Invalid && getLangOpts().CPlusPlus) ? 0 : New;
}
void Sema::ActOnTagStartDefinition(Scope *S, Decl *TagD) {
int f(a::b::c); // expected-error {{use of undeclared identifier 'a'}}
class Foo::Bar { // expected-error {{use of undeclared identifier 'Foo'}} \
- // expected-note {{to match this '{'}} \
// expected-error {{expected ';' after class}}
- // expected-error {{expected '}'}}
// expected-note {{'Uuuu' declared here}}
} *u[3];
uuuu v; // expected-error {{did you mean 'Uuuu'}}
+
+struct Redefined { // expected-note {{previous}}
+ Redefined() {}
+};
+struct Redefined { // expected-error {{redefinition}}
+ Redefined() {}
+};