Don't try to parse a malformed parameter list after a constructor or operator

name as a direct initializer.

llvm-svn: 153628
This commit is contained in:
Richard Smith 2012-03-29 01:46:00 +00:00
parent 39d0ab3243
commit 0191023b5a
2 changed files with 8 additions and 5 deletions

View File

@ -1655,6 +1655,10 @@ public:
Context != FileContext)
return false;
// Special names can't have direct initializers.
if (Name.getKind() != UnqualifiedId::IK_Identifier)
return false;
switch (Context) {
case FileContext:
case BlockContext:

View File

@ -72,17 +72,16 @@ namespace ctor_error {
Ctor(x[5]); // expected-error{{incomplete type}}
Ctor(UnknownType *); // expected-error{{unknown type name 'UnknownType'}}
void operator+(UnknownType*); // expected-error{{unknown type name 'UnknownType'}}
};
Ctor::Ctor (x) = { 0 }; // \
// expected-error{{qualified reference to 'Ctor' is a constructor name}}
// FIXME: These diagnostics are terrible.
Ctor::Ctor(UnknownType *) {} // \
// expected-error{{'Ctor' cannot be the name of a variable or data member}} \
// expected-error{{use of undeclared identifier 'UnknownType'}} \
// expected-error{{expected expression}} \
// expected-error{{expected ';' after top level declarator}}
// expected-error{{unknown type name 'UnknownType'}}
void Ctor::operator+(UnknownType*) {} // \
// expected-error{{unknown type name 'UnknownType'}}
}
// PR11109 must appear at the end of the source file