]> granicus.if.org Git - clang/commitdiff
PR31783: Don't request the alignment of an invalid declaration.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 27 Jan 2017 21:28:37 +0000 (21:28 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 27 Jan 2017 21:28:37 +0000 (21:28 +0000)
Fixes an assertion failure on PS4 targets.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293333 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp
test/SemaCXX/auto-cxx0x.cpp

index 3ed6ede53cf97f8d0c7610a955054d5afb3d6678..ce843a587b74be25e42c3279bb2cc2fa9f8563cb 100644 (file)
@@ -10930,7 +10930,8 @@ Sema::FinalizeDeclaration(Decl *ThisDecl) {
   if (unsigned MaxAlign = Context.getTargetInfo().getMaxTLSAlign()) {
     // Protect the check so that it's not performed on dependent types and
     // dependent alignments (we can't determine the alignment in that case).
-    if (VD->getTLSKind() && !hasDependentAlignment(VD)) {
+    if (VD->getTLSKind() && !hasDependentAlignment(VD) &&
+        !VD->isInvalidDecl()) {
       CharUnits MaxAlignChars = Context.toCharUnitsFromBits(MaxAlign);
       if (Context.getDeclAlign(VD) > MaxAlignChars) {
         Diag(VD->getLocation(), diag::err_tls_var_aligned_over_maximum)
index f3daf1a19f3cafb43d58cec892a15ffdec7befdd..c37b1386b3af56cd0db2165a42d61034f04d395c 100644 (file)
@@ -6,3 +6,5 @@ void f() {
 }
 
 typedef auto PR25449(); // expected-error {{'auto' not allowed in typedef}}
+
+thread_local auto x; // expected-error {{requires an initializer}}