1af475173SCorentin Jabot // RUN: %clang_cc1 -std=c++2b -emit-llvm -triple=x86_64-pc-win32 -o - %s 2>/dev/null | FileCheck %s 2af475173SCorentin Jabot 3af475173SCorentin Jabot struct S { 4af475173SCorentin Jabot friend void test(); 5af475173SCorentin Jabot public: 6af475173SCorentin Jabot void a(this auto){} 7af475173SCorentin Jabot void b(this auto&){} 8af475173SCorentin Jabot void c(this S){} 9af475173SCorentin Jabot void c(this S, int){} 10af475173SCorentin Jabot private: 11af475173SCorentin Jabot void d(this auto){} 12af475173SCorentin Jabot void e(this auto&){} 13af475173SCorentin Jabot void f(this S){} 14af475173SCorentin Jabot void f(this S, int){} 15af475173SCorentin Jabot protected: 16af475173SCorentin Jabot void g(this auto){} 17af475173SCorentin Jabot void h(this auto&){} 18af475173SCorentin Jabot void i(this S){} 19af475173SCorentin Jabot void i(this S, int){} 20af475173SCorentin Jabot }; 21af475173SCorentin Jabot 22af475173SCorentin Jabot void test() { 23af475173SCorentin Jabot S s; 24af475173SCorentin Jabot s.a(); 25af475173SCorentin Jabot // CHECK: call void @"??$a@US@@@S@@SAX_VU0@@Z" 26af475173SCorentin Jabot s.b(); 27af475173SCorentin Jabot // CHECK: call void @"??$b@US@@@S@@SAX_VAEAU0@@Z" 28af475173SCorentin Jabot s.c(); 29af475173SCorentin Jabot // CHECK: call void @"?c@S@@SAX_VU1@@Z" 30af475173SCorentin Jabot s.c(0); 31af475173SCorentin Jabot // CHECK: call void @"?c@S@@SAX_VU1@H@Z" 32af475173SCorentin Jabot s.d(); 33af475173SCorentin Jabot // CHECK: call void @"??$d@US@@@S@@CAX_VU0@@Z" 34af475173SCorentin Jabot s.e(); 35af475173SCorentin Jabot // CHECK: call void @"??$e@US@@@S@@CAX_VAEAU0@@Z" 36af475173SCorentin Jabot s.f(); 37af475173SCorentin Jabot // CHECK: call void @"?f@S@@CAX_VU1@@Z" 38af475173SCorentin Jabot s.f(0); 39af475173SCorentin Jabot // CHECK: call void @"?f@S@@CAX_VU1@H@Z" 40af475173SCorentin Jabot s.g(); 41af475173SCorentin Jabot // CHECK: call void @"??$g@US@@@S@@KAX_VU0@@Z" 42af475173SCorentin Jabot s.h(); 43af475173SCorentin Jabot // CHECK: call void @"??$h@US@@@S@@KAX_VAEAU0@@Z" 44af475173SCorentin Jabot s.i(); 45af475173SCorentin Jabot // CHECK: call void @"?i@S@@KAX_VU1@@Z" 46af475173SCorentin Jabot s.i(0); 47af475173SCorentin Jabot // CHECK: call void @"?i@S@@KAX_VU1@H@Z" 48af475173SCorentin Jabot } 49af475173SCorentin Jabot 50af475173SCorentin Jabot 51af475173SCorentin Jabot struct S2 { 52af475173SCorentin Jabot int i = 0; 53af475173SCorentin Jabot void foo(this const S2&, int); 54af475173SCorentin Jabot }; 55af475173SCorentin Jabot struct T { 56af475173SCorentin Jabot S2 bar(this const T&, int); 57af475173SCorentin Jabot }; 58af475173SCorentin Jabot void chain_test() { 59af475173SCorentin Jabot T t; 60af475173SCorentin Jabot t.bar(0).foo(0); 61af475173SCorentin Jabot } 62af475173SCorentin Jabot // CHECK: define {{.*}}chain_test{{.*}} 63af475173SCorentin Jabot // CHECK-NEXT: entry: 64af475173SCorentin Jabot // CHECK: {{.*}} = alloca %struct.T, align 1 65af475173SCorentin Jabot // CHECK: {{.*}} = alloca %struct.S2, align 4 66af475173SCorentin Jabot // CHECK: %call = call i32 @"?bar@T@@SA?AUS2@@_VAEBU1@H@Z"{{.*}} 67*94473f4dSHari Limaye // CHECK: %coerce.dive = getelementptr inbounds nuw %struct.S2, {{.*}} %{{.*}}, i32 0, i32 0 68af475173SCorentin Jabot // CHECK store i32 %call, ptr %coerce.dive, align 4 69af475173SCorentin Jabot // CHECK: call void @"?foo@S2@@SAX_VAEBU1@H@Z" 70af475173SCorentin Jabot // CHECK: ret void 71