xref: /llvm-project/clang/test/CodeGenCXX/cxx2b-mangle-deducing-this.cpp (revision af4751738db89a142a8880c782d12d4201b222a8)
1 // RUN: %clang_cc1 -std=c++2b -emit-llvm -triple x86_64-linux -o - %s 2>/dev/null | FileCheck %s
2 
3 struct S {
4 friend void test();
5 public:
aS6     void a(this auto){}
bS7     void b(this auto&){}
cS8     void c(this S){}
cS9     void c(this S, int){}
10 private:
dS11     void d(this auto){}
eS12     void e(this auto&){}
fS13     void f(this S){}
fS14     void f(this S, int){}
15 protected:
gS16     void g(this auto){}
hS17     void h(this auto&){}
iS18     void i(this S){}
iS19     void i(this S, int){}
20 };
21 
22 
test()23 void test() {
24     S s;
25     s.a();
26     // CHECK: call void @_ZNH1S1aIS_EEvT_
27     s.b();
28     // CHECK: call void @_ZNH1S1bIS_EEvRT_
29     s.c();
30     // CHECK: call void @_ZNH1S1cES_
31     s.c(0);
32     // CHECK: call void @_ZNH1S1cES_i
33     s.d();
34     // CHECK: call void @_ZNH1S1dIS_EEvT_
35     s.e();
36     // CHECK: call void @_ZNH1S1eIS_EEvRT_
37     s.f();
38     // CHECK: call void @_ZNH1S1fES_
39     s.f(0);
40     // CHECK: call void @_ZNH1S1fES_i
41     s.g();
42     // CHECK: call void @_ZNH1S1gIS_EEvT_
43     s.h();
44     // CHECK: call void @_ZNH1S1hIS_EEvRT_
45     s.i();
46     // CHECK: call void @_ZNH1S1iES_
47     s.i(0);
48     // CHECK: call void @_ZNH1S1iES_i
49 }
50 
51 struct StaticAndExplicit {
52   static void f(StaticAndExplicit);
53   void f(this StaticAndExplicit);
54 };
55 
test2()56 void test2() {
57     StaticAndExplicit s;
58 
59     StaticAndExplicit::f(s);
60     // CHECK: call void @_ZN17StaticAndExplicit1fES_
61 
62     s.f();
63     // CHECK: call void @_ZNH17StaticAndExplicit1fES_
64 }
65