xref: /llvm-project/clang/test/SemaCXX/cxx2b-ast-print.cpp (revision 7c1d9b15eee3a34678addab2bab66f3020ac0753)
1 // RUN: %clang_cc1 -std=c++23 -ast-print %s | FileCheck %s
2 
3 template <template <class...> class C>
test_auto_expr(long long y,auto && z)4 void test_auto_expr(long long y, auto &&z) {
5   int x[] = {3, 4};
6 
7   // CHECK{LITERAL}: (int)(x[1])
8   void(auto(x[1]));
9   // CHECK{LITERAL}: (int){x[1]}
10   void(auto{x[1]});
11 
12   // CHECK{LITERAL}: (int *)(x)
13   void(auto(x));
14   // CHECK{LITERAL}: (int *){x}
15   void(auto{x});
16 
17   // CHECK{LITERAL}: auto(z)
18   void(auto(z));
19   // CHECK{LITERAL}: auto{z}
20   void(auto{z});
21 
22   // CHECK{LITERAL}: new int *(x)
23   void(new auto(x));
24   // CHECK{LITERAL}: new int *{x}
25   void(new auto{x});
26 
27   // CHECK{LITERAL}: new auto(z)
28   void(new auto(z));
29   // CHECK{LITERAL}: new auto{z}
30   void(new auto{z});
31 
32   // CHECK{LITERAL}: new long long(y)
33   void(new decltype(auto)(y));
34   // CHECK{LITERAL}: new long long{y}
35   void(new decltype(auto){y});
36 
37   // CHECK{LITERAL}: new decltype(auto)(z)
38   void(new decltype(auto)(z));
39   // CHECK{LITERAL}: new decltype(auto){z}
40   void(new decltype(auto){z});
41 
42   // CHECK{LITERAL}: C(x, y, z)
43   void(C(x, y, z));
44   // CHECK{LITERAL}: C{x, y, z}
45   void(C{x, y, z});
46 
47   // CHECK{LITERAL}: new C(x, y, z)
48   void(new C(x, y, z));
49   // CHECK{LITERAL}: new C{x, y, z}
50   void(new C{x, y, z});
51 }
52