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