diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-03-27 01:22:48 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-03-27 01:22:48 +0000 |
commit | dc4ccaaf666b7be417c3a66cb71ae094a865bc37 (patch) | |
tree | 6c43330ecf77605ba5d84cb7f9cc7f65e42d15f3 /clang/lib/Sema/SemaDecl.cpp | |
parent | ffa4b7993f4846f65bfe1c380ed98fe7e7270225 (diff) | |
download | bcm5719-llvm-dc4ccaaf666b7be417c3a66cb71ae094a865bc37.tar.gz bcm5719-llvm-dc4ccaaf666b7be417c3a66cb71ae094a865bc37.zip |
PR19252: Fix crash if alignas is used with an auto-typed variable. Don't check
the type of the variable until it's known.
llvm-svn: 204887
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index e4511c925fc..bfbd870eefc 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -5344,9 +5344,6 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, // Handle attributes prior to checking for duplicates in MergeVarDecl ProcessDeclAttributes(S, NewVD, D); - if (NewVD->hasAttrs()) - CheckAlignasUnderalignment(NewVD); - if (getLangOpts().CUDA) { // CUDA B.2.5: "__shared__ and __constant__ variables have implied static // storage [duration]." @@ -5734,6 +5731,9 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) { if (T->isUndeducedType()) return; + if (NewVD->hasAttrs()) + CheckAlignasUnderalignment(NewVD); + if (T->isObjCObjectType()) { Diag(NewVD->getLocation(), diag::err_statically_allocated_object) << FixItHint::CreateInsertion(NewVD->getLocation(), "*"); @@ -5851,7 +5851,6 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) { if (NewVD->isConstexpr() && !T->isDependentType() && RequireLiteralType(NewVD->getLocation(), T, diag::err_constexpr_var_non_literal)) { - // Can't perform this check until the type is deduced. NewVD->setInvalidDecl(); return; } |