diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2011-10-24 22:25:55 +0000 |
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2011-10-24 22:25:55 +0000 |
| commit | 9190e19b6609ae889cd7d9f82e31a81a2267d7af (patch) | |
| tree | eaa24234405ac0e0a3088b62c0a41ee6374bc816 | |
| parent | 89ab56d5fbe36b28e3228d5b3deebb0357d7c5c5 (diff) | |
| download | bcm5719-llvm-9190e19b6609ae889cd7d9f82e31a81a2267d7af.tar.gz bcm5719-llvm-9190e19b6609ae889cd7d9f82e31a81a2267d7af.zip | |
Don't try to emit CK_LValueBitCast casts as constants. PR9558.
llvm-svn: 142863
| -rw-r--r-- | clang/lib/CodeGen/CGExprConstant.cpp | 2 | ||||
| -rw-r--r-- | clang/test/CodeGenCXX/const-init.cpp | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp index 3997866ea68..31e0f2c3b0e 100644 --- a/clang/lib/CodeGen/CGExprConstant.cpp +++ b/clang/lib/CodeGen/CGExprConstant.cpp @@ -573,7 +573,6 @@ public: case CK_CPointerToObjCPointerCast: case CK_BlockPointerToObjCPointerCast: case CK_AnyPointerToBlockPointerCast: - case CK_LValueBitCast: case CK_BitCast: if (C->getType() == destType) return C; return llvm::ConstantExpr::getBitCast(C, destType); @@ -589,6 +588,7 @@ public: case CK_ARCConsumeObject: case CK_ARCReclaimReturnedObject: case CK_ARCExtendBlockObject: + case CK_LValueBitCast: return 0; // These might need to be supported for constexpr. diff --git a/clang/test/CodeGenCXX/const-init.cpp b/clang/test/CodeGenCXX/const-init.cpp index 797d1377f69..f06e546ec9a 100644 --- a/clang/test/CodeGenCXX/const-init.cpp +++ b/clang/test/CodeGenCXX/const-init.cpp @@ -36,3 +36,7 @@ namespace test2 { double t0 = A::d; double t1[] = { A::d, A::f }; } + +// We don't expect to fold this in the frontend, but make sure it doesn't crash. +// CHECK: @PR9558 = global float 0.000000e+0 +float PR9558 = reinterpret_cast<const float&>("asd"); |

