r228523 - Sema: Don't give attribute alias vars with struct type an init expr
David Majnemer
david.majnemer at gmail.com
Sun Feb 8 02:55:15 PST 2015
Author: majnemer
Date: Sun Feb 8 04:55:14 2015
New Revision: 228523
URL: http://llvm.org/viewvc/llvm-project?rev=228523&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaCXX/cxx11-gnu-attrs.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=228523&r1=228522&r2=228523&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sun Feb 8 04:55:14 2015
@@ -9259,6 +9259,8 @@ void Sema::ActOnUninitializedDecl(Decl *
Var->setInvalidDecl();
return;
}
+ } else {
+ return;
}
// The variable can not have an abstract class type.
Modified: cfe/trunk/test/SemaCXX/cxx11-gnu-attrs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx11-gnu-attrs.cpp?rev=228523&r1=228522&r2=228523&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/cxx11-gnu-attrs.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx11-gnu-attrs.cpp Sun Feb 8 04:55:14 2015
@@ -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 {};
More information about the cfe-commits
mailing list