[C++] Interpret unknown identifier in parameter clause as unknown type

instead of as parameter name without a type.

llvm-svn: 359979
This commit is contained in:
Nicolas Lesser 2019-05-05 12:15:17 +00:00
parent 60211cb872
commit ee0571734f
3 changed files with 5 additions and 4 deletions

View File

@ -2649,6 +2649,9 @@ bool Parser::ParseImplicitInt(DeclSpec &DS, CXXScopeSpec *SS,
case tok::semi:
// This looks like a variable or function declaration. The type is
// probably missing. We're done parsing decl-specifiers.
// But only if we are not in a function prototype scope.
if (getCurScope()->isFunctionPrototypeScope())
break;
if (SS)
AnnotateScopeToken(*SS, /*IsNewAnnotation*/false);
return false;

View File

@ -64,7 +64,7 @@ void avoidPlaceholderErrors(Struct &obj) {
}
}
void Struct::method(<#Struct &x#>, noSupressionHere) { // expected-error {{unknown type name 'noSupressionHere'}} expected-error {{C++ requires a type specifier for all declarations}}
void Struct::method(<#Struct &x#>, noSupressionHere) { // expected-error {{unknown type name 'noSupressionHere'}}
#ifndef SUPPRESS
// expected-error@-2 {{editor placeholder in source file}}
#endif

View File

@ -72,9 +72,7 @@ void f(int, T::type x, char) { } // expected-error{{missing 'typename'}}
int *p;
// FIXME: We should assume that 'undeclared' is a type, not a parameter name
// here, and produce an 'unknown type name' diagnostic instead.
int f1(undeclared, int); // expected-error{{requires a type specifier}}
int f1(undeclared, int); // expected-error{{unknown type name 'undeclared'}}
int f2(undeclared, 0); // expected-error{{undeclared identifier}}