1 // RUN: %clang_cc1 -pedantic-errors -std=c++11 -emit-pch %s -o %t-cxx11 2 // RUN: %clang_cc1 -ast-print -pedantic-errors -std=c++11 -include-pch %t-cxx11 %s | FileCheck -check-prefix=CHECK-PRINT %s 3 4 #ifndef HEADER_INCLUDED 5 6 #define HEADER_INCLUDED 7 8 int nontemplate_test(double d) { 9 struct Local { 10 template<class T> T foo(T t) { 11 return t; 12 } 13 }; 14 return Local{}.foo(d); 15 } 16 17 template<class U> 18 U template_test(U d) { 19 struct Local { 20 template<class T> T foo(T t) { 21 return t; 22 } 23 }; 24 return Local{}.foo(d); 25 } 26 27 int nested_local() { 28 struct Inner1 { 29 int inner1_foo(char c) { 30 struct Inner2 { 31 template<class T> T inner2_foo(T t) { 32 return t; 33 } 34 }; 35 return Inner2{}.inner2_foo(3.14); 36 } 37 }; 38 return Inner1{}.inner1_foo('a'); 39 } 40 41 #else 42 43 // CHECK-PRINT: U template_test 44 45 // CHECK-PRINT: int nontemplate_test(double) 46 47 int nontemplate_test(double); 48 49 template double template_test(double); 50 int test2(int y) { 51 return nontemplate_test(y) + template_test(y); 52 } 53 54 55 #endif 56