1 // RUN: %clang_cc1 -std=c++23 %s -emit-llvm -o - | FileCheck %s
3 void should_be_used_1();
4 void should_be_used_2();
5 void should_be_used_3();
6 constexpr void should_not_be_used() {}
10 should_not_be_used(); // CHECK-NOT: call {{.*}}should_not_be_used
12 should_be_used_1(); // CHECK: call {{.*}}should_be_used_1
16 should_be_used_2(); // CHECK: call {{.*}}should_be_used_2
20 should_be_used_3(); // CHECK: call {{.*}}should_be_used_3
22 should_not_be_used(); // CHECK-NOT: call {{.*}}should_not_be_used
32 constexpr bool is_constant_evaluated() noexcept
{
33 if consteval
{ return true; } else { return false; }
36 constexpr int compiletime(int) {
40 constexpr int runtime(int) {
44 constexpr int test(int x
) {
45 if(is_constant_evaluated())
46 return compiletime(x
); // CHECK-NOT: call {{.*}}compiletime
47 return runtime(x
); // CHECK: call {{.*}}runtime