aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclCXX.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r--lib/Sema/SemaDeclCXX.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 82830ef4ad..e3a0063b0d 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -2547,7 +2547,7 @@ Sema::DeclPtrTy Sema::ActOnExceptionDeclarator(Scope *S, Declarator &D) {
QualType ExDeclType = GetTypeForDeclarator(D, S);
SourceLocation Begin = D.getDeclSpec().getSourceRange().getBegin();
- bool Invalid = false;
+ bool Invalid = D.isInvalidType();
// Arrays and functions decay.
if (ExDeclType->isArrayType())
@@ -2597,15 +2597,15 @@ Sema::DeclPtrTy Sema::ActOnExceptionDeclarator(Scope *S, Declarator &D) {
VarDecl *ExDecl = VarDecl::Create(Context, CurContext, D.getIdentifierLoc(),
II, ExDeclType, VarDecl::None, Begin);
- if (D.getInvalidType() || Invalid)
- ExDecl->setInvalidDecl();
-
- if (D.getCXXScopeSpec().isSet()) {
+ if (D.getCXXScopeSpec().isSet() && !Invalid) {
Diag(D.getIdentifierLoc(), diag::err_qualified_catch_declarator)
<< D.getCXXScopeSpec().getRange();
- ExDecl->setInvalidDecl();
+ Invalid = true;
}
+ if (Invalid)
+ ExDecl->setInvalidDecl();
+
// Add the exception declaration into this scope.
S->AddDecl(DeclPtrTy::make(ExDecl));
if (II)