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