brintos

brintos / llvm-project-archived public Read only

0
0
Text · 421 B · df5191b Raw
22 lines · cpp
1// RUN: %clang_cc1 -emit-llvm %s -std=c++20 -triple x86_64-unknown-linux-gnu -o - | FileCheck %s2 3namespace GH63742 {4 5void side_effect();6consteval int f(int x) {7    if (!__builtin_is_constant_evaluated()) side_effect();8    return x;9}10struct SS {11    int x = f(42);12    SS();13};14SS::SS(){}15 16}17 18// CHECK-LABEL: @_ZN7GH637422SSC2Ev19// CHECK-NOT:   call20// CHECK:       store i32 42, ptr {{.*}}21// CHECK:       ret void22