mirror of
https://github.com/intel/llvm.git
synced 2026-01-24 08:30:34 +08:00
Extend lvalue evaluation in ExprConstant.cpp to handle CK_LValueBitCast (which is completely trivial). PR8836.
llvm-svn: 141604
This commit is contained in:
@@ -481,7 +481,10 @@ public:
|
||||
return false;
|
||||
|
||||
case CK_NoOp:
|
||||
case CK_LValueBitCast:
|
||||
return Visit(E->getSubExpr());
|
||||
|
||||
// FIXME: Support CK_DerivedToBase and friends.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,3 +57,7 @@ int foo() { return A::B; }
|
||||
// PR11040
|
||||
const int x = 10;
|
||||
int* y = reinterpret_cast<const char&>(x); // expected-error {{cannot initialize}}
|
||||
|
||||
// This isn't an integral constant expression, but make sure it folds anyway.
|
||||
struct PR8836 { char _; long long a; };
|
||||
int PR8836test[(__typeof(sizeof(int)))&reinterpret_cast<const volatile char&>((((PR8836*)0)->a))];
|
||||
|
||||
Reference in New Issue
Block a user