xref: /llvm-project/clang/test/CodeGenCXX/cxx2c-consteval-propagate.cpp (revision 8698262a4365bf22b5b0c96e77bfecd3dcf084a7)
1 // RUN: %clang_cc1 -emit-llvm %s -std=c++20 -triple x86_64-unknown-linux-gnu -o - | FileCheck %s
2 
3 namespace GH63742 {
4 
5 void side_effect();
f(int x)6 consteval int f(int x) {
7     if (!__builtin_is_constant_evaluated()) side_effect();
8     return x;
9 }
10 struct SS {
11     int x = f(42);
12     SS();
13 };
SS()14 SS::SS(){}
15 
16 }
17 
18 // CHECK-LABEL: @_ZN7GH637422SSC2Ev
19 // CHECK-NOT:   call
20 // CHECK:       store i32 42, ptr {{.*}}
21 // CHECK:       ret void
22