Don't try to emit CK_LValueBitCast casts as constants. PR9558.

llvm-svn: 142863
This commit is contained in:
Eli Friedman 2011-10-24 22:25:55 +00:00
parent 89ab56d5fb
commit 9190e19b66
2 changed files with 5 additions and 1 deletions

View File

@ -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.

View File

@ -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");