PR31783: Don't request the alignment of an invalid declaration.

Fixes an assertion failure on PS4 targets.

llvm-svn: 293333
This commit is contained in:
Richard Smith 2017-01-27 21:28:37 +00:00
parent 35ce5dac7f
commit 78aacbe2f9
2 changed files with 4 additions and 1 deletions

View 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)

View 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}}