From 33947ed22c57e11e7aa88e803bfdd664fe50412f Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Sun, 8 Feb 2015 10:55:14 +0000 Subject: [PATCH] Sema: Don't give attribute alias vars with struct type an init expr We'd give the VarDecl a CXXConstructExpr even though it is annotated with an alias attribute. This would make us trip over sanity checking asserts. This fixes PR22493. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228523 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaDecl.cpp | 2 ++ test/SemaCXX/cxx11-gnu-attrs.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index a5ce9a0277..f187ee2474 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -9259,6 +9259,8 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl, Var->setInvalidDecl(); return; } + } else { + return; } // The variable can not have an abstract class type. diff --git a/test/SemaCXX/cxx11-gnu-attrs.cpp b/test/SemaCXX/cxx11-gnu-attrs.cpp index 9f182249a3..ac9cc55b9f 100644 --- a/test/SemaCXX/cxx11-gnu-attrs.cpp +++ b/test/SemaCXX/cxx11-gnu-attrs.cpp @@ -15,6 +15,9 @@ void aliasb [[gnu::alias("_Z6alias1v")]] (); void alias1() {} void aliasa [[gnu::alias("_Z6alias1v")]] (); +extern struct PR22493Ty { +} PR22493 [[gnu::alias("_ZN7pcrecpp2RE6no_argE")]]; + [[gnu::aligned(8)]] int aligned; void aligned_fn [[gnu::aligned(32)]] (); struct [[gnu::aligned(8)]] aligned_struct {}; -- 2.40.0