diff options
Diffstat (limited to 'test/PCH/cxx-templates.h')
-rw-r--r-- | test/PCH/cxx-templates.h | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/test/PCH/cxx-templates.h b/test/PCH/cxx-templates.h new file mode 100644 index 0000000..3968536 --- /dev/null +++ b/test/PCH/cxx-templates.h @@ -0,0 +1,102 @@ +// Header for PCH test cxx-templates.cpp + +template <typename T1, typename T2> +struct S; + +template <typename T1, typename T2> +struct S { + S() { } + static void templ(); +}; + +template <typename T> +struct S<int, T> { + static void partial(); +}; + +template <> +struct S<int, float> { + static void explicit_special(); +}; + +template <int x> +int tmpl_f2() { return x; } + +template <typename T, int y> +T templ_f(T x) { + int z = templ_f<int, 5>(3); + z = tmpl_f2<y+2>(); + T data[y]; + return x+y; +} + +void govl(int); +void govl(char); + +template <typename T> +struct Unresolv { + void f() { + govl(T()); + } +}; + +template <typename T> +struct Dep { + typedef typename T::type Ty; + void f() { + Ty x = Ty(); + T::my_f(); + int y = T::template my_templf<int>(0); + ovl(y); + } + + void ovl(int); + void ovl(float); +}; + +template<typename T, typename A1> +inline T make_a(const A1& a1) { + T::depend_declref(); + return T(a1); +} + +template <class T> class UseBase { + void foo(); + typedef int bar; +}; + +template <class T> class UseA : public UseBase<T> { + using UseBase<T>::foo; + using typename UseBase<T>::bar; +}; + +template <class T> class Sub : public UseBase<int> { }; + +template <class _Ret, class _Tp> + class mem_fun_t + { + public: + explicit + mem_fun_t(_Ret (_Tp::*__pf)()) + {} + + private: + _Ret (_Tp::*_M_f)(); + }; + +template<unsigned N> +bool isInt(int x); + +template<> bool isInt<8>(int x) { + return true; +} + +template<typename _CharT> +int __copy_streambufs_eof(_CharT); + +class basic_streambuf +{ + void m() { } + friend int __copy_streambufs_eof<>(int); +}; + |