aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Parse/ParseDecl.cpp1
-rw-r--r--lib/Sema/SemaDecl.cpp7
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index e3094ad7c6..70d65f3b48 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -1494,6 +1494,7 @@ void Parser::ParseDirectDeclarator(Declarator &D) {
else
Diag(Tok, diag::err_expected_ident_lparen); // Expected identifier or '('.
D.SetIdentifier(0, Tok.getLocation());
+ D.setInvalidType(true);
}
assert(D.isPastIdentifier() &&
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 6c71d50895..879a79b633 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -753,9 +753,10 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) {
// All of these full declarators require an identifier. If it doesn't have
// one, the ParsedFreeStandingDeclSpec action should be used.
if (II == 0) {
- Diag(D.getDeclSpec().getSourceRange().getBegin(),
- diag::err_declarator_need_ident,
- D.getDeclSpec().getSourceRange(), D.getSourceRange());
+ if (!D.getInvalidType()) // Reject this if we think it is valid.
+ Diag(D.getDeclSpec().getSourceRange().getBegin(),
+ diag::err_declarator_need_ident,
+ D.getDeclSpec().getSourceRange(), D.getSourceRange());
return 0;
}