// RUN: %clang_cc1 -std=c++1z -ast-print %s > %t // RUN: FileCheck < %t %s -check-prefix=CHECK1 // RUN: FileCheck < %t %s -check-prefix=CHECK2 // RUN: %clang_cc1 -std=c++1z -ast-dump %s | FileCheck --check-prefix=DUMP %s template struct foo { int constant; foo() {} Y getSum() { return Y(X + Z); } }; template B bar() { return B(A); } void baz() { int x = bar<5, int>(); int y = foo<5, int>().getSum(); double z = foo<2, double, 3>().getSum(); } // Template definition - foo // CHECK1: template struct foo { // CHECK2: template struct foo { // Template instantiation - foo // Since the order of instantiation may vary during runs, run FileCheck twice // to make sure each instantiation is in the correct spot. // CHECK1: template<> struct foo<5, int, 5> { // CHECK2: template<> struct foo<2, double, 3> { // Template definition - bar // CHECK1: template B bar() // CHECK2: template B bar() // Template instantiation - bar // CHECK1: template<> int bar<5, int>() // CHECK2: template<> int bar<5, int>() // CHECK1-LABEL: template struct A { // CHECK1-NEXT: template struct B { template struct A { template struct B {}; }; // CHECK1-LABEL: template void f(T ...[3]) { // CHECK1-NEXT: A a; template void f(T ...[3]) { A a; } namespace test2 { void func(int); void func(float); template void tmpl() { func(T()); } // DUMP: UnresolvedLookupExpr {{.*}} '' lvalue (ADL) = 'func' } namespace test3 { template struct A {}; template A(T) -> A; // CHECK1: template A(T) -> A; }