summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/const-init-cxx11.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-01-05 23:59:40 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-01-05 23:59:40 +0000
commitb1bc368ca7950eddd7fd3da69050ac260bd68dcf (patch)
treeac328ccae220cb5b33d4dc76a2b7add73d0b532d /clang/test/CodeGenCXX/const-init-cxx11.cpp
parent5ab9c0a9270d34b8f7b2eee600b47a62dadf82c0 (diff)
downloadbcm5719-llvm-b1bc368ca7950eddd7fd3da69050ac260bd68dcf.tar.gz
bcm5719-llvm-b1bc368ca7950eddd7fd3da69050ac260bd68dcf.zip
Address Richard's review comments on r147561 (Evaluate support for address-of-label differences).
llvm-svn: 147631
Diffstat (limited to 'clang/test/CodeGenCXX/const-init-cxx11.cpp')
-rw-r--r--clang/test/CodeGenCXX/const-init-cxx11.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/const-init-cxx11.cpp b/clang/test/CodeGenCXX/const-init-cxx11.cpp
new file mode 100644
index 00000000000..5ec9a690f98
--- /dev/null
+++ b/clang/test/CodeGenCXX/const-init-cxx11.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin -emit-llvm -o - %s -std=c++11 | FileCheck %s
+
+namespace CrossFuncLabelDiff {
+ // Make sure we refuse to constant-fold the variable b.
+ constexpr long a() { return (long)&&lbl + (0 && ({lbl: 0;})); }
+ void test() { static long b = (long)&&lbl - a(); lbl: return; }
+ // CHECK: sub nsw i64 ptrtoint (i8* blockaddress(@_ZN18CrossFuncLabelDiff4testEv, {{.*}}) to i64),
+ // CHECK: store i64 {{.*}}, i64* @_ZZN18CrossFuncLabelDiff4testEvE1b, align 8
+}
OpenPOWER on IntegriCloud