1 // RUN: clang-cc -fsyntax-only -verify %s
2 template<typename T, typename U = const T> struct Def1;
4 template<> struct Def1<int> {
8 template<> struct Def1<const int> { // expected-note{{previous definition is here}}
12 template<> struct Def1<int&> {
16 void test_Def1(Def1<int, const int> *d1, Def1<const int, const int> *d2,
17 Def1<int&, int&> *d3) {
23 template<typename T, // FIXME: bad error message below, needs better location info
24 typename T2 = const T*> // expected-error{{'T2' declared as a pointer to a reference}}
27 template<> struct Def2<int> {
31 void test_Def2(Def2<int, int const*> *d2) {
35 typedef int& int_ref_t;
36 Def2<int_ref_t> *d2; // expected-note{{in instantiation of default argument for 'Def2<int &>' required here}}
39 template<> struct Def1<const int, const int> { }; // expected-error{{redefinition of 'Def1<int const>'}}
41 template<typename T, typename T2 = T&> struct Def3;
43 template<> struct Def3<int> {
47 template<> struct Def3<int&> {
51 void test_Def3(Def3<int, int&> *d3a, Def3<int&, int&> *d3b) {
57 template<typename T, typename T2 = T[]> struct Def4;
59 template<> struct Def4<int> {
63 void test_Def4(Def4<int, int[]> *d4a) {
67 template<typename T, typename T2 = T const[12]> struct Def5;
69 template<> struct Def5<int> {
73 template<> struct Def5<int, int const[13]> {
77 void test_Def5(Def5<int, const int[12]> *d5a, Def5<int, const int[13]> *d5b) {
82 template<typename R, typename Arg1, typename Arg2 = Arg1,
83 typename FuncType = R (*)(Arg1, Arg2)>
86 template<> struct Def6<int, float> {
90 template<> struct Def6<bool, int[5], float(double, double)> {
94 bool test_Def6(Def6<int, float, float> *d6a,
95 Def6<int, float, float, int (*)(float, float)> *d6b,
96 Def6<bool, int[5], float(double, double),
97 bool(*)(int*, float(*)(double, double))> *d6c) {