brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 54a02ff Raw
55 lines · cpp
1// RUN: %clang_cc1 -std=c++2a -triple x86_64-elf-gnu %s -emit-llvm -o - | FileCheck %s2 3consteval int immediate() { return 0;}4static int ext();5void f(int a = immediate() + ext());6 7void test_function() {8    f();9    f(0);10    // CHECK: call noundef i32 @_ZL3extv()11    // CHECK: add12    // CHECK: call {{.*}} @_Z1fi13    // CHECK: call {{.*}} @_Z1fi14}15 16// CHECK: define {{.*}} i32 @_ZL3extv()17 18static constexpr int not_immediate();19struct A {20    int a = immediate() + not_immediate();21};22 23void test_member() {24    // CHECK: call void @_ZN1AC2Ev25    A defaulted;26    // CHECK-NOT: call void @_ZN1AC2Ev27    A provided{0};28}29 30// CHECK: define {{.*}} void @_ZN1AC2Ev{{.*}}31// CHECK: %call = call noundef i32 @_ZL13not_immediatev()32 33int never_referenced() {return 42;};34 35 36namespace not_used {37 38struct A {39    int a = immediate() + never_referenced();40};41void f(int a = immediate() + never_referenced());42 43void g() {44    A a{0};45    f(0);46}47 48}49 50static int ext() {return 0;}51static constexpr int not_immediate() {return 0;}52 53// CHECK-NOT: define {{.*}} i32 _ZL16never_referencedv()(54// CHECK: define {{.*}} i32 @_ZL13not_immediatev()55