1 // RUN: clang-cc -fsyntax-only -verify %s 2 template<typename T, typename U = float> struct A { }; 3 4 typedef A<int> A_int; 5 6 typedef float FLOAT; 7 8 A<int, FLOAT> *foo(A<int> *ptr, A<int> const *ptr2, A<int, double> *ptr3) { 9 if (ptr) 10 return ptr; // okay 11 else if (ptr2) 12 return ptr2; // expected-error{{incompatible type returning 'A<int> const *', expected 'A<int, FLOAT> *'}} 13 else { 14 return ptr3; // expected-error{{incompatible type returning 'A<int, double> *', expected 'A<int, FLOAT> *'}} 15 } 16 } 17 18 template<int I> struct B; 19 20 const int value = 12; 21 B<17 + 2> *bar(B<(19)> *ptr1, B< (::value + 7) > *ptr2, B<19 - 3> *ptr3) { 22 if (ptr1) 23 return ptr1; 24 else if (ptr2) 25 return ptr2; 26 else 27 return ptr3; // expected-error{{incompatible type returning 'B<19 - 3> *', expected 'B<17 + 2> *'}} 28 } 29 30 typedef B<5> B5; 31 32 33 namespace N { 34 template<typename T> struct C {}; 35 } 36 37 N::C<int> c1; 38 typedef N::C<float> c2; 39