30 lines · cpp
1// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump %s | FileCheck -strict-whitespace %s2 3namespace a {4struct S;5template <typename T> T x = {};6}7namespace b {8using a::S;9// CHECK: UsingDecl {{.*}} a::S10// CHECK-NEXT: | `-NestedNameSpecifier Namespace {{.*}} 'a'11// CHECK-NEXT: UsingShadowDecl {{.*}} implicit CXXRecord {{.*}} 'S'12// CHECK-NEXT: `-CXXRecordDecl {{.*}} referenced struct S13typedef S f; // to dump the introduced type14// CHECK: TypedefDecl15// CHECK-NEXT: `-UsingType [[TYPE_ADDR:.*]] 'S' sugar 'a::S'16// CHECK-NEXT: |-UsingShadow [[SHADOW_ADDR:.*]] 'S'17// CHECK-NEXT: `-RecordType {{.*}} 'a::S'18typedef S e; // check the same UsingType is reused.19// CHECK: TypedefDecl20// CHECK-NEXT: `-UsingType [[TYPE_ADDR]] 'S' sugar 'a::S'21// CHECK-NEXT: |-UsingShadow [[SHADOW_ADDR]] 'S'22// CHECK-NEXT: `-RecordType {{.*}} 'a::S'23using a::x;24 25void foo() {26 x<int> = 3;27 // CHECK: DeclRefExpr {{.*}} 'x' {{.*}} (UsingShadow {{.*}} 'x')28}29}30