diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2011-10-11 00:13:24 +0000 | 
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2011-10-11 00:13:24 +0000 | 
| commit | ce3e02a343d69099f1b75d76838c810e958e4e84 (patch) | |
| tree | f87467d7bff9830f0ddd30975700508eec93cb09 | |
| parent | fd2d7dcc312916bff767158b1efef3460dbcf759 (diff) | |
| download | bcm5719-llvm-ce3e02a343d69099f1b75d76838c810e958e4e84.tar.gz bcm5719-llvm-ce3e02a343d69099f1b75d76838c810e958e4e84.zip  | |
Extend lvalue evaluation in ExprConstant.cpp to handle CK_LValueBitCast (which is completely trivial).  PR8836.
llvm-svn: 141604
| -rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 3 | ||||
| -rw-r--r-- | clang/test/SemaCXX/i-c-e-cxx.cpp | 4 | 
2 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 3da744955a6..c0f913d7ed6 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -481,7 +481,10 @@ public:        return false;      case CK_NoOp: +    case CK_LValueBitCast:        return Visit(E->getSubExpr()); + +    // FIXME: Support CK_DerivedToBase and friends.      }    } diff --git a/clang/test/SemaCXX/i-c-e-cxx.cpp b/clang/test/SemaCXX/i-c-e-cxx.cpp index 4ebdada4922..4d02ca8f174 100644 --- a/clang/test/SemaCXX/i-c-e-cxx.cpp +++ b/clang/test/SemaCXX/i-c-e-cxx.cpp @@ -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))];  | 

