// Header for PCH test cxx-templates.cpp template struct S; template struct S { S() { } static void templ(); }; template struct S { static void partial(); }; template <> struct S { static void explicit_special(); }; template int tmpl_f2() { return x; } template T templ_f(T x) { int z = templ_f(3); z = tmpl_f2(); T data[y]; return x+y; } void govl(int); void govl(char); template struct Unresolv { void f() { govl(T()); } }; template struct Dep { typedef typename T::type Ty; void f() { Ty x = Ty(); T::my_f(); int y = T::template my_templf(0); ovl(y); } void ovl(int); void ovl(float); }; template inline T make_a(const A1& a1) { T::depend_declref(); return T(a1); } template class UseBase { void foo(); typedef int bar; }; template class UseA : public UseBase { using UseBase::foo; using typename UseBase::bar; }; template class Sub : public UseBase { }; template class mem_fun_t { public: explicit mem_fun_t(_Ret (_Tp::*__pf)()) {} private: _Ret (_Tp::*_M_f)(); }; template bool isInt(int x); template<> bool isInt<8>(int x) { try { ++x; } catch(...) { --x; } return true; } template int __copy_streambufs_eof(_CharT); class basic_streambuf { void m() { } friend int __copy_streambufs_eof<>(int); }; // PR 7660 template struct S_PR7660 { void g(void (*)(T)); }; template<> void S_PR7660::g(void(*)(int)) {} // PR 7670 template class C_PR7670; template<> class C_PR7670; template<> class C_PR7670; template struct S2 { static bool V; }; extern template class S2; template struct S3 { void m(); }; template inline void S3::m() { } template struct S4 { void m() { } }; extern template struct S4; void S4ImplicitInst() { S4 s; s.m(); } struct S5 { S5(int x); }; struct TS5 { S5 s; template TS5(T y) : s(y) {} }; // PR 8134 template void f_PR8134(T); template void f_PR8134(T); void g_PR8134() { f_PR8134(0); f_PR8134('x'); } // rdar8580149 template struct S6; template struct S6 { private: typedef const T t1[N]; public: typedef t1& t2; }; template struct S7; template struct S7 : S6 { }; // Zero-length template argument lists namespace ZeroLengthExplicitTemplateArgs { template void h(); struct Y { template void f(); }; template void f(T *ptr) { T::template g<>(17); ptr->template g2<>(17); h(); h(); Y y; y.f(); } struct X { template static void g(T); template void g2(T); }; } namespace NonTypeTemplateParmContext { template class Vector { }; struct String { template static String adopt(Vector&); }; template inline bool equalIgnoringNullity(const Vector& a, const String& b) { return false; } } // template< typename > class Foo; template< typename T > class Foo : protected T { public: Foo& operator=( const Foo& other ); }; template struct NestedExpansion { template auto f(A...a, B...b) -> decltype(g(a + b...)); }; template struct NestedExpansion; namespace rdar13135282 { template < typename _Alloc > void foo(_Alloc = _Alloc()); template < bool > class __pool; template < template < bool > class _PoolTp > struct __common_pool { typedef _PoolTp < 0 > pool_type; }; template < template < bool > class _PoolTp > struct __common_pool_base : __common_pool < _PoolTp > {}; template < template < bool > class _PoolTp > struct A : __common_pool_base < _PoolTp > {}; template < typename _Poolp = A < __pool > > struct __mt_alloc { typedef typename _Poolp::pool_type __pool_type; __mt_alloc() { foo<__mt_alloc<> >(); } }; } namespace PR13020 { template void f() { enum E { enumerator }; T t = enumerator; } template void f(); } template void doNotDeserialize() {} template struct ContainsDoNotDeserialize { static int doNotDeserialize; }; template struct ContainsDoNotDeserialize2 { static void doNotDeserialize(); }; template int ContainsDoNotDeserialize::doNotDeserialize = 0; template void ContainsDoNotDeserialize2::doNotDeserialize() {} template void DependentSpecializedFunc(T x) { x.foo(); } template class DependentSpecializedFuncClass { void foo() {} friend void DependentSpecializedFunc<>(DependentSpecializedFuncClass); }; namespace cyclic_module_load { // Reduced from a libc++ modules crasher. namespace std { template class mask_array; template class valarray { public: valarray(const valarray &v); }; class gslice { valarray x; valarray stride() const { return x; } }; template class mask_array { template friend class valarray; }; } } namespace local_extern { template int f() { extern int arr[3]; { extern T arr; return sizeof(arr); } } template int g() { extern int arr[3]; extern T arr; return sizeof(arr); } }