--- /dev/null
+// Build don't link:
+// GROUPS passed templates
+template <class T>
+void foo(T t) {}
+
+void bar()
+{
+ &foo<double>;
+}
--- /dev/null
+// Build don't link:
+// GROUPS passed templates
+template <class T>
+void foo(T t);
+
+int main()
+{
+ foo<int>(3.0);
+}
--- /dev/null
+// Build don't link:
+// GROUPS passed templates
+template <class T>
+void foo(T t);
+
+template <class T>
+struct S {};
+
+int main()
+{
+ S<int> si;
+
+ foo<S<int> >(si);
+}
--- /dev/null
+// Build don't run:
+// GROUPS passed templates
+template <class U>
+struct S
+{
+ template <class T>
+ void foo(T t);
+
+ template <>
+ void foo<int>(int) {}
+};
+
+int main()
+{
+ S<char*> s;
+ s.template foo<int>(3.0);
+}
--- /dev/null
+// Build don't run:
+// GROUPS passed templates
+
+template <class U>
+struct S
+{
+ template <class T>
+ void foo(T t);
+
+ template <>
+ void foo(int) { }
+
+ template <class T>
+ void bar(T t) { this->template foo<U>(3.74); }
+};
+
+int main()
+{
+ S<int> s;
+ s.bar(3);
+}
--- /dev/null
+// Build don't link:
+// GROUPS passed templates
+template <class T>
+struct S
+{
+ template <class U>
+ typename U::R foo(U u);
+};
+
+
+void bar()
+{
+ S<int> si;
+}
--- /dev/null
+// Build don't link:
+// GROUPS passed templates
+template<int N_rank>
+class Array;
+
+
+template<class T>
+class ArraySectionInfo {
+public:
+ enum { rank = 0 };
+};
+
+
+template<class T1>
+class SliceInfo {
+public:
+ enum {
+ rank = ArraySectionInfo<T1>::rank
+ };
+
+ typedef Array<rank> T_slice;
+};
+
+template<class T2>
+typename SliceInfo<T2>::T_slice
+foo(T2 r2)
+{
+ return SliceInfo<T2>::T_slice();
+}
+
--- /dev/null
+// Build don't link:
+// GROUPS passed templates
+template<int N_rank>
+class Array;
+
+
+template<class T>
+class ArraySectionInfo {
+public:
+ enum { rank = 0 };
+};
+
+
+template<class T1>
+class SliceInfo {
+public:
+ static const int rank = ArraySectionInfo<T1>::rank;
+
+ typedef Array<rank> T_slice;
+};
+
+template<class T2>
+typename SliceInfo<T2>::T_slice
+foo(T2 r2)
+{
+ return SliceInfo<T2>::T_slice();
+}
+
--- /dev/null
+// Build don't link:
+// GROUPS passed templates
+template <class T, class U>
+void foo(U u, T t);
+
+template <class T>
+void foo(T t);
+
+template <class T>
+struct S {};
+
+template <class T>
+void foo(const S<T>&);
+
+void bar()
+{
+ void (*fn)(double, int) =
+ (void (*)(double, int)) &foo<int>;
+ void (*fn2)(double) = foo<double>;
+ foo<int>(3, 3.0);
+ foo<int>(S<int>());
+}
--- /dev/null
+// Build don't run:
+// GROUPS passed templates
+template <class T>
+int foo(T t) { return 0; }
+
+int foo(int i);
+
+int main()
+{
+ return foo<int>(3.0);
+}
--- /dev/null
+// Build don't run:
+// GROUPS passed templates
+template <class T>
+int foo(T t);
+
+template <>
+int foo<int>(int i) { return 0; }
+
+int main()
+{
+ return foo<int>(3.0);
+}
--- /dev/null
+// Build don't link:
+// GROUPS passed templates
+template <class T>
+void foo(T t) {}
+
+void bar()
+{
+ (void (*)(int)) &foo<double>;
+}
--- /dev/null
+// Build don't link:
+// GROUPS passed templates
+template <class T>
+T foo(T t);
+
+template <>
+int foo<char>(char c); // ERROR - bad return type.
--- /dev/null
+// Build don't link:
+// GROUPS passed templates
+template <class T>
+T foo(T* t);
+
+template <>
+int foo<char>(char c); // ERROR - does not match declaration.
+
+template <>
+int bar<char>(); // ERROR - no template bar.
--- /dev/null
+// Build don't link:
+// GROUPS passed templates
+template <class T, class U>
+T foo(T t, U* u);
+
+template <class T>
+T foo(T t, T* t);
+
+template <>
+int foo<int>(int, int*); // ERROR - ambiguous specialization.
--- /dev/null
+// Build don't run:
+// GROUPS passed templates
+template <class T>
+int foo(T t) { return 1; }
+
+template <>
+int foo<int>(int i) { return 0; }
+
+int main()
+{
+ return foo<int>(3.0);
+}
--- /dev/null
+// Build don't link:
+// GROUPS passed templates
+template <class T>
+int foo(T t);
+
+int foo<int>(int i) { return 0; } // ERROR - missing template <>
+
--- /dev/null
+// Build don't link:
+// GROUPS passed templates
+template <int I>
+class S {};
+
+template <int I, class T>
+void foo(T t, S<I>);
+
+void bar()
+{
+ S<3> s3;
+ foo<3>("abc", s3);
+}
--- /dev/null
+// Build don't run:
+// GROUPS passed templates
+template <class T>
+int foo(T t) { return 1; }
+
+template <>
+int foo(int i) { return 0; }
+
+int main()
+{
+ &foo<int>;
+}
--- /dev/null
+// Build don't run:
+// GROUPS passed templates
+template <class T>
+void foo(T t);
+
+template <>
+void foo(int i) {}
+
+int main()
+{
+ &foo<int>;
+}
--- /dev/null
+// Build don't run:
+// GROUPS passed templates
+template <class T>
+int foo(T t) { return 1; }
+
+template <>
+int foo(int i) { return 0; }
+
+int main()
+{
+ return (*&foo<int>)(3);
+}
--- /dev/null
+// Build don't run:
+// GROUPS passed templates
+template <class T>
+int foo(T) { return 0; }
+
+int foo(int);
+
+int main()
+{
+ return foo<int>(3);
+}
+
--- /dev/null
+// Build don't link:
+// GROUPS passed templates
+template <class T, class U>
+void foo(T t, U u) {}
+
+void bar()
+{
+ (void (*)(double, int)) &foo<double>;
+}
--- /dev/null
+// Build don't link:
+// GROUPS passed templates
+template <class T>
+void foo(T, T*);
+
+
+void bar()
+{
+ double d;
+ (*((void (*)(int, double*)) &foo<int>))(3, &d);
+}
--- /dev/null
+// Build don't run:
+// GROUPS passed templates
+template <class T>
+struct S
+{
+ template <class U>
+ static double foo(U u) { return (double) u; }
+};
+
+
+int main()
+{
+ double d = S<int>::template foo<char>(3.3);
+
+ return (d >= 3.1);
+}
--- /dev/null
+// Build don't link:
+// GROUPS passed templates
+template <class T>
+struct S
+{
+};
+
+
+template <>
+struct S<int>
+{
+ void foo();
+};
+
+template <>
+void S<int>::foo()
+{
+}
+
+
+void bar()
+{
+ S<int> si;
+ si.foo();
+}
--- /dev/null
+// Build don't link:
+// GROUPS passed templates
+template <class T>
+void foo(T t);
+
+template <>
+void foo(int) {};
+
+void foo(int) {}
--- /dev/null
+// Build don't link:
+// GROUPS passed templates
+template <class T>
+void foo(T t);
+
+template <>
+void foo(int) {}; // ERROR - redefinition.
+
+template <>
+void foo<int>(int) {} // ERROR - redefinition.
--- /dev/null
+// Build don't run:
+// GROUPS passed templates
+struct S
+{
+ template <class T>
+ void foo(T t);
+
+ template <>
+ void foo<int>(int i) { }
+};
+
+int main()
+{
+ S s;
+ s.template foo<int>(3.0);
+}
--- /dev/null
+// Build don't link:
+// GROUPS passed templates
+template <class T>
+void foo(T t);
+
+template <class T>
+struct S {};
+
+template <class T>
+void bar(T t)
+{
+ void (*f)(S<T> ) = &foo<S<T> >;
+}
+
+
+void baz()
+{
+ bar(3);
+}
--- /dev/null
+// Build don't link:
+// GROUPS passed templates
+template <class T>
+void foo(T t) {}
+
+template <class T>
+struct S {};
+
+template <class T>
+void bar(T t)
+{
+ void (*f)(S<T> ) = &foo<S<T> >;
+}
+
+
+void baz()
+{
+ bar(3);
+}
--- /dev/null
+// Build don't run:
+// GROUPS passed templates
+template <class T>
+int foo(T t);
+
+template <>
+int foo(int i) { return 0; }
+
+int main()
+{
+ return foo<int>(3.0);
+}
--- /dev/null
+// Build don't run:
+// GROUPS passed templates
+struct S
+{
+ template <class T>
+ void foo(T t);
+
+ template <>
+ void foo<int>(int i) { }
+};
+
+int main()
+{
+ S s;
+ s.template foo<int>(3.0);
+}
--- /dev/null
+// Build don't link:
+// GROUPS passed templates
+template <class T, class U>
+void foo(T t, U u);
+
+template <class U>
+void foo(double, U) {}
+
+void baz()
+{
+ foo<char*>(3.0, "abc");
+ foo<char*, double>("abc", 3.0);
+}
--- /dev/null
+// Build don't link:
+// GROUPS passed templates
+void foo(int);
+
+void bar()
+{
+ foo<int>(3); // ERROR - foo is not a template.
+}
--- /dev/null
+// Build don't link:
+// GROUPS passed membertemplates
+template <class T>
+class S
+{
+ S(const S<T>& x) {}
+
+ template <class U>
+ S(const S<U>& x) {}
+};
--- /dev/null
+// Build don't run:
+// GROUPS passed membertemplates
+struct S
+{
+ template <class T>
+ void foo(T t);
+
+ template <>
+ void foo(int i);
+};
+
+
+template <>
+void S::foo(int i)
+{
+}
+
+
+int main()
+{
+ S s;
+ s.foo(3);
+}
--- /dev/null
+// Build don't run:
+// GROUPS passed membertemplates
+struct S
+{
+ template <class T>
+ void foo(T t);
+
+ template <>
+ void foo(int i);
+};
+
+
+template <>
+void S::foo<int>(int i)
+{
+}
+
+
+int main()
+{
+ S s;
+ s.foo(3);
+}
--- /dev/null
+template<int N_length>
+struct B
+{
+ B();
+ ~B();
+};
+template<class P, int N>
+struct D
+{
+ D(int r0);
+ D(B<N-1> &, int);
+};
+template<class T>
+void func()
+{
+ D<T,1> tmp;
+}
--- /dev/null
+struct X {
+ enum {
+ a = 0,
+ n = 0
+ };
+};
+
+template<class T1, class T2>
+struct Y {
+
+ enum {
+ a = T1::a + T2::a,
+
+ n = meta_max<T1::n,T2::n>::max // Crash here.
+ };
+};
+
+int z = Y<X,X>::a;
--- /dev/null
+template<class T>
+struct A {
+ typedef T T1;
+};
+
+template<class T>
+struct B {
+ typedef T T2;
+};
+
+template<class T>
+struct C {
+};
+
+template<class E>
+C<typename E::T2::T1>
+foo (E)
+{
+ return C<typename E::T2::T1>();
+}
+
+void test()
+{
+ foo(B<A<int> >());
+}
--- /dev/null
+ template <class T>
+ struct S
+ {
+ struct R
+ {
+ R();
+ ~R();
+ };
+
+ void foo()
+ {
+ R r;
+ int i;
+ }
+
+ S();
+ ~S();
+ };
+
+ void f()
+ {
+ S<int> si;
+ si.foo();
+ }