summaryrefslogtreecommitdiff
path: root/test/CodeGenCXX/cxx1z-constexpr-if.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGenCXX/cxx1z-constexpr-if.cpp')
-rw-r--r--test/CodeGenCXX/cxx1z-constexpr-if.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/CodeGenCXX/cxx1z-constexpr-if.cpp b/test/CodeGenCXX/cxx1z-constexpr-if.cpp
new file mode 100644
index 0000000000000..80a397f51e9a9
--- /dev/null
+++ b/test/CodeGenCXX/cxx1z-constexpr-if.cpp
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -std=c++1z %s -emit-llvm -o - | FileCheck %s --implicit-check-not=should_not_be_used
+
+void should_be_used_1();
+void should_be_used_2();
+void should_not_be_used();
+void f() {
+ if constexpr (false)
+ should_not_be_used();
+ else
+ should_be_used_1();
+
+ if constexpr (true || ({ label: false; }))
+ should_be_used_2();
+ else {
+ goto foo;
+foo: should_not_be_used();
+ }
+}
+
+// CHECK: should_be_used_1
+// CHECK: should_be_used_2