xref: /llvm-project/clang/test/AST/new-unknown-type.cpp (revision 4bd81c5738d00c9111fc11cb9990a9377d33eaf3)
1 // RUN: %clang_cc1 -verify -ast-dump %s | FileCheck %s
2 
3 extern void foo(Unknown*); // expected-error {{unknown type name 'Unknown'}}
4 
5 namespace a {
6   void computeSomething() {
7     foo(new Unknown()); // expected-error {{unknown type name 'Unknown'}}
8     foo(new Unknown{}); // expected-error {{unknown type name 'Unknown'}}
9     foo(new Unknown);   // expected-error {{unknown type name 'Unknown'}}
10   }
11 } // namespace a
12 
13 namespace b {
14   struct Bar{};
15 } // namespace b
16 
17 // CHECK:      |-NamespaceDecl 0x{{[^ ]*}} <line:5:1, line:11:1> line:5:11 a
18 // CHECK-NEXT: | `-FunctionDecl 0x{{[^ ]*}} <line:6:3, line:10:3> line:6:8 computeSomething 'void ()'
19 // CHECK-NEXT: |   `-CompoundStmt 0x{{[^ ]*}} <col:27, line:10:3>
20 // CHECK-NEXT: |-NamespaceDecl 0x{{[^ ]*}} <line:13:1, line:15:1> line:13:11 b
21 // CHECK-NEXT: | `-CXXRecordDecl 0x{{[^ ]*}} <line:14:3, col:14> col:10 referenced struct Bar definition
22 
23 static b::Bar bar;
24 // CHECK:      `-VarDecl 0x{{[^ ]*}} <line:23:1, col:15> col:15 bar 'b::Bar' static callinit
25 // CHECK-NEXT:   `-CXXConstructExpr 0x{{[^ ]*}} <col:15> 'b::Bar' 'void () noexcept'
26