diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-01-12 06:08:57 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-01-12 06:08:57 +0000 |
commit | 61e616206413d1779c7545c7a8ad1ce1129ad9c1 (patch) | |
tree | 864235e3a0798289f3c267470fde05b3c0f171a0 /test/CodeGenCXX/const-init.cpp | |
parent | 746f5bcbfde5b25269169c63c66492311673b67d (diff) |
Allow constant-folding of references which were formed in a manner not permitted
in a constant expression, for compatibility with g++.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148020 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/const-init.cpp')
-rw-r--r-- | test/CodeGenCXX/const-init.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/CodeGenCXX/const-init.cpp b/test/CodeGenCXX/const-init.cpp index 1cfcdba22f..201ce8f0c6 100644 --- a/test/CodeGenCXX/const-init.cpp +++ b/test/CodeGenCXX/const-init.cpp @@ -69,3 +69,10 @@ void UnfoldableAddrLabelDiff() { static __int128_t x = (long)&&a-(long)&&b; a:b: // But make sure we do fold this. // CHECK: @_ZZ21FoldableAddrLabelDiffvE1x = internal global i64 sub (i64 ptrtoint (i8* blockaddress(@_Z21FoldableAddrLabelDiffv void FoldableAddrLabelDiff() { static long x = (long)&&a-(long)&&b; a:b:return;} + +// CHECK: @i = constant i32* bitcast (float* @PR9558 to i32*) +int &i = reinterpret_cast<int&>(PR9558); + +int arr[2]; +// CHECK: @pastEnd = constant i32* bitcast (i8* getelementptr (i8* bitcast ([2 x i32]* @arr to i8*), i64 8) to i32*) +int &pastEnd = arr[2]; |