blob: 416625097064bb1552f11dddd822c1958b4ff3e1 [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}} \
Douglas Gregor5fad9b82011-10-12 20:35:48 +000015// expected-note{{candidate template ignored: substitution failure [with X = int]}}
Stephen Hines651f13c2014-04-23 16:59:28 -070016int a(B<int> x) { return operator==(&x,1); } // expected-error{{no matching function for call to 'operator=='}} \
17// expected-note{{in instantiation of function template specialization}}