blob: 30d6ccfb9597fb6fd6b8b7f3e18940b9d0a2758b [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Eli Friedman5d39dee2009-06-27 05:59:59 +00002
3// Make sure we accept this
4template<class X>struct A{typedef X Y;};
Richard Smith29805ca2013-01-31 05:19:49 +00005template<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 Gregor5fad9b82011-10-12 20:35:48 +00006
Eli Friedman5d39dee2009-06-27 05:59:59 +00007int a(A<int> x) { return operator==(x,1); }
8
Douglas Gregor364e0212009-06-27 21:05:07 +00009int a0(A<int> x) { return x == 1; }
10
Douglas Gregorcca9e962009-07-01 22:01:06 +000011// FIXME: the location information for the note isn't very good
Eli Friedman5d39dee2009-06-27 05:59:59 +000012template<class X>struct B{typedef X Y;};
13template<class X>bool operator==(B<X>*,typename B<X>::Y); // \
Douglas Gregor5fad9b82011-10-12 20:35:48 +000014// 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]}}
17int a(B<int> x) { return operator==(&x,1); } // expected-error{{no matching function for call to 'operator=='}}
Eli Friedman5d39dee2009-06-27 05:59:59 +000018