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;}; |
| 5 | template<class X>bool operator==(A<X>,typename A<X>::Y); |
| 6 | int a(A<int> x) { return operator==(x,1); } |
| 7 | |
Douglas Gregor | 364e021 | 2009-06-27 21:05:07 +0000 | [diff] [blame] | 8 | int a0(A<int> x) { return x == 1; } |
| 9 | |
Douglas Gregor | cca9e96 | 2009-07-01 22:01:06 +0000 | [diff] [blame] | 10 | // FIXME: the location information for the note isn't very good |
Eli Friedman | 5d39dee | 2009-06-27 05:59:59 +0000 | [diff] [blame] | 11 | template<class X>struct B{typedef X Y;}; |
| 12 | template<class X>bool operator==(B<X>*,typename B<X>::Y); // \ |
| 13 | expected-error{{overloaded 'operator==' must have at least one parameter of class or enumeration type}} \ |
Douglas Gregor | 66724ea | 2009-11-14 01:20:54 +0000 | [diff] [blame] | 14 | expected-note{{in instantiation of function template specialization}} |
Douglas Gregor | fd47648 | 2009-11-13 23:59:09 +0000 | [diff] [blame] | 15 | int a(B<int> x) { return operator==(&x,1); } |
Eli Friedman | 5d39dee | 2009-06-27 05:59:59 +0000 | [diff] [blame] | 16 | |