1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s 2 // expected-no-diagnostics 3 4 // Check for declaration matching with out-of-line declarations and 5 // variadic templates, which involves proper computation of the 6 // injected-class-name. 7 template<typename T, typename ...Types> 8 struct X0 { 9 typedef T type; 10 11 void f0(T); 12 type f1(T); 13 }; 14 15 template<typename T, typename ...Types> 16 void X0<T, Types...>::f0(T) { } 17 18 template<typename T, typename ...Types> 19 typename X0<T, Types...>::type X0<T, Types...>::f1(T) { } 20 21 template<typename T, typename ...Types> 22 struct X0<T, T, Types...> { 23 typedef T* result; 24 result f3(); 25 26 template<typename... InnerTypes> 27 struct Inner; 28 }; 29 30 template<typename T, typename ...Types> 31 typename X0<T, T, Types...>::result X0<T, T, Types...>::f3() { return 0; } 32 33 template<typename T, typename ...Types> 34 template<typename ...InnerTypes> 35 struct X0<T, T, Types...>::Inner { 36 template<typename ...ReallyInner> void f4(); 37 }; 38 39 template<typename T, typename ...Types> 40 template<typename ...InnerTypes> 41 template<typename ...ReallyInner> 42 void X0<T, T, Types...>::Inner<InnerTypes...>::f4() { } 43 44 namespace rdar8848837 { 45 // Out-of-line definitions that cause rebuilding in the current 46 // instantiation. 47 template<typename F> struct X; 48 49 template<typename R, typename ...ArgTypes> 50 struct X<R(ArgTypes...)> { 51 X<R(ArgTypes...)> f(); 52 }; 53 54 template<typename R, typename ...ArgTypes> 55 X<R(ArgTypes...)> X<R(ArgTypes...)>::f() { return *this; } 56 57 58 X<int(float, double)> xif; 59 60 template<unsigned> struct unsigned_c { }; 61 template<typename ...ArgTypes> int g(ArgTypes...); 62 63 template<typename F> struct X1; 64 65 template<typename R, typename ...ArgTypes> 66 struct X1<R(ArgTypes...)> { 67 unsigned_c<sizeof(1 + g(ArgTypes()...))> f(); 68 }; 69 70 template<typename R, typename ...ArgTypes> 71 unsigned_c<sizeof(1 + g(ArgTypes()...))> X1<R(ArgTypes...)>::f() { 72 return unsigned_c<sizeof(int)>(); 73 } 74 75 X1<int(float, double)> xif2; 76 } 77