Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Eli Friedman | 5d39dee | 2009-06-27 05:59:59 +0000 | [diff] [blame] | 2 | |
| 3 | // Make sure we accept this |
| 4 | template<class X>struct A{typedef X Y;}; |
Richard Smith | 29805ca | 2013-01-31 05:19:49 +0000 | [diff] [blame^] | 5 | template<class X>bool operator==(A<X>,typename A<X>::Y); // expected-note{{candidate template ignored: could not match 'A<type-parameter-0-0>' against 'B<int> *'}} |
Douglas Gregor | 5fad9b8 | 2011-10-12 20:35:48 +0000 | [diff] [blame] | 6 | |
Eli Friedman | 5d39dee | 2009-06-27 05:59:59 +0000 | [diff] [blame] | 7 | int a(A<int> x) { return operator==(x,1); } |
| 8 | |
Douglas Gregor | 364e021 | 2009-06-27 21:05:07 +0000 | [diff] [blame] | 9 | int a0(A<int> x) { return x == 1; } |
| 10 | |
Douglas Gregor | cca9e96 | 2009-07-01 22:01:06 +0000 | [diff] [blame] | 11 | // FIXME: the location information for the note isn't very good |
Eli Friedman | 5d39dee | 2009-06-27 05:59:59 +0000 | [diff] [blame] | 12 | template<class X>struct B{typedef X Y;}; |
| 13 | template<class X>bool operator==(B<X>*,typename B<X>::Y); // \ |
Douglas Gregor | 5fad9b8 | 2011-10-12 20:35:48 +0000 | [diff] [blame] | 14 | // expected-error{{overloaded 'operator==' must have at least one parameter of class or enumeration type}} \ |
| 15 | // expected-note{{in instantiation of function template specialization}} \ |
| 16 | // expected-note{{candidate template ignored: substitution failure [with X = int]}} |
| 17 | int a(B<int> x) { return operator==(&x,1); } // expected-error{{no matching function for call to 'operator=='}} |
Eli Friedman | 5d39dee | 2009-06-27 05:59:59 +0000 | [diff] [blame] | 18 | |