xref: /llvm-project/clang/test/AST/ast-dump-pack-indexing-crash.cpp (revision 7a94acb2da5b20d12f13f3c5f4eb0f3f46e78e73)
1 // RUN: not %clang_cc1 -std=c++2c -ast-dump %s | FileCheck  %s
2 
3 namespace InvalidPacksShouldNotCrash {
4 
5 struct NotAPack;
6 template <typename T, auto V, template<typename> typename Tp>
not_pack()7 void not_pack() {
8     int i = 0;
9     i...[0]; // expected-error {{i does not refer to the name of a parameter pack}}
10     V...[0]; // expected-error {{V does not refer to the name of a parameter pack}}
11     NotAPack...[0] a; // expected-error{{'NotAPack' does not refer to the name of a parameter pack}}
12     T...[0] b;   // expected-error{{'T' does not refer to the name of a parameter pack}}
13     Tp...[0] c; // expected-error{{'Tp' does not refer to the name of a parameter pack}}
14 }
15 
16 // CHECK:      FunctionDecl {{.*}} not_pack 'void ()'
17 // CHECK:           DeclStmt {{.*}}
18 // CHECK:           DeclStmt {{.*}}
19 // CHECK-NEXT:        VarDecl {{.*}} a 'NotAPack...{{.*}}'
20 // CHECK-NEXT:      DeclStmt {{.*}}
21 // CHECK-NEXT:        VarDecl {{.*}} 'T...{{.*}}'
22 // CHECK-NEXT:       DeclStmt {{.*}}
23 // CHECK-NEXT:        VarDecl {{.*}} c 'Tp...{{.*}}'
24 
25 }
26