diff options
author | Enea Zaffanella <zaffanella@cs.unipr.it> | 2013-01-11 14:34:39 +0000 |
---|---|---|
committer | Enea Zaffanella <zaffanella@cs.unipr.it> | 2013-01-11 14:34:39 +0000 |
commit | 29e1c4b03efefe4e3942757a4ad4710fe9ac284c (patch) | |
tree | e3e9adc54a7fd5d047f48042d6c9ea354923709c /clang/lib/Sema | |
parent | fd8c4b1321165c9ac6de235ceb74b6bcb4e43296 (diff) | |
download | bcm5719-llvm-29e1c4b03efefe4e3942757a4ad4710fe9ac284c.tar.gz bcm5719-llvm-29e1c4b03efefe4e3942757a4ad4710fe9ac284c.zip |
Fixed an assertion failure triggered by invalid code.
Set invalid type of declarator after emitting error diagnostics,
so that it won't be later considered when instantiating the template.
Added test5_inst in test/SemaCXX/condition.cpp for non-regression.
llvm-svn: 172201
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r-- | clang/lib/Sema/SemaType.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 1bdd7c3b398..60db55aff33 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -1996,6 +1996,7 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state, SemaRef.Diag(OwnedTagDecl->getLocation(), diag::err_type_defined_in_alias_template) << SemaRef.Context.getTypeDeclType(OwnedTagDecl); + D.setInvalidType(true); break; case Declarator::TypeNameContext: case Declarator::TemplateParamContext: @@ -2006,6 +2007,7 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state, SemaRef.Diag(OwnedTagDecl->getLocation(), diag::err_type_defined_in_type_specifier) << SemaRef.Context.getTypeDeclType(OwnedTagDecl); + D.setInvalidType(true); break; case Declarator::PrototypeContext: case Declarator::ObjCParameterContext: @@ -2016,6 +2018,7 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state, SemaRef.Diag(OwnedTagDecl->getLocation(), diag::err_type_defined_in_param_type) << SemaRef.Context.getTypeDeclType(OwnedTagDecl); + D.setInvalidType(true); break; case Declarator::ConditionContext: // C++ 6.4p2: @@ -2023,6 +2026,7 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state, // a new class or enumeration. SemaRef.Diag(OwnedTagDecl->getLocation(), diag::err_type_defined_in_condition); + D.setInvalidType(true); break; } } |