2016-06-24 03:16:49 +08:00
|
|
|
// 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();
|
2016-09-08 02:24:54 +08:00
|
|
|
void should_be_used_3();
|
2016-06-24 03:16:49 +08:00
|
|
|
void should_not_be_used();
|
2016-09-08 02:24:54 +08:00
|
|
|
|
|
|
|
struct A {
|
|
|
|
constexpr explicit operator bool() const {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-06-24 03:16:49 +08:00
|
|
|
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();
|
|
|
|
}
|
2016-09-08 02:24:54 +08:00
|
|
|
if constexpr (A())
|
|
|
|
should_be_used_3();
|
|
|
|
else
|
|
|
|
should_not_be_used();
|
2016-06-24 03:16:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK: should_be_used_1
|
|
|
|
// CHECK: should_be_used_2
|
2016-09-08 02:24:54 +08:00
|
|
|
// CHECK: should_be_used_3
|