diff options
-rw-r--r-- | lib/CodeGen/CGExprConstant.cpp | 2 | ||||
-rw-r--r-- | test/CodeGenCXX/member-pointers-zero-init.cpp | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp index e67a747fa1..b3e0fef1ba 100644 --- a/lib/CodeGen/CGExprConstant.cpp +++ b/lib/CodeGen/CGExprConstant.cpp @@ -414,6 +414,8 @@ public: llvm::StructType::get(C->getType()->getContext(), Types, false); return llvm::ConstantStruct::get(STy, Elts); } + case CastExpr::CK_NullToMemberPointer: + return CGM.EmitNullConstant(E->getType()); default: { // FIXME: This should be handled by the CK_NoOp cast kind. // Explicit and implicit no-op casts diff --git a/test/CodeGenCXX/member-pointers-zero-init.cpp b/test/CodeGenCXX/member-pointers-zero-init.cpp index db7c71a0d4..c0b76f3d5a 100644 --- a/test/CodeGenCXX/member-pointers-zero-init.cpp +++ b/test/CodeGenCXX/member-pointers-zero-init.cpp @@ -7,12 +7,15 @@ struct A { // RUN: grep "@a = global i64 -1" %t && int A::* a; -// RUN: grep "@aa = global \[2 x i64\] \[i64 -1, i64 -1\], align 8" %t && +// RUN: grep "@aa = global \[2 x i64\] \[i64 -1, i64 -1\]" %t && int A::* aa[2]; // RUN: grep "@aaa = global \[2 x \[2 x i64\]\] \[\[2 x i64\] \[i64 -1, i64 -1\], \[2 x i64\] \[i64 -1, i64 -1\]\]" %t && int A::* aaa[2][2]; +// RUN: grep "@b = global i64 -1" %t && +int A::* b = 0; + void f() { // RUN: grep "%.obool = icmp ne i64 %.mp, -1" %t if (a) { } |