Debian Codegraph @

clang/test/AST/ast-dump-cxx2b-deducing-this.cpp

raw
1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -std=c++2b -ast-dump %s | FileCheck -strict-whitespace %s
2
3 namespace GH116928 {
4 struct S {
5 int f(this S&);
6 };
7
8 void main() {
9 S s;
10 int x = s.f();
11 // CHECK: CallExpr 0x{{[^ ]*}} <col:11, col:15> 'int
12 // CHECK-NEXT: |-ImplicitCastExpr 0x{{[^ ]*}} <col:13> 'int (*)(S &)' <FunctionToPointerDecay>
13 // CHECK-NEXT: | `-DeclRefExpr 0x{{[^ ]*}} <col:13> 'int (S &)' lvalue CXXMethod 0x{{[^ ]*}} 'f' 'int (S &)'
14 }
15 }
16
17 namespace GH1269720 {
18 template <typename T>
19 struct S {
20 void f(this S&);
21 void g(S s) {
22 s.f();
23 }
24 // CHECK: CallExpr 0x{{[^ ]*}} <line:22:5, col:9> '<dependent type>'
25 // CHECK-NEXT: `-MemberExpr 0x{{[^ ]*}} <col:5, col:7> '<bound member function type>' .f
26 // CHECK-NEXT: `-DeclRefExpr 0x{{[^ ]*}} <col:5> 'S<T>' lvalue ParmVar 0x{{[^ ]*}} 's' 'S<T>'
27 };
28 }
29
30 namespace GH130272 {
31 struct A {};
32 struct B {
33 operator A(this B);
34 };
35 A a = A(B{});
36 // CHECK: CallExpr 0x{{[^ ]*}} <col:9, col:11> 'A'
37 }