1// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
2
3namespace bullet2 {
4
5// For non-member candidates, if no operand has a class type, only those
6// non-member functions that have a matching enumeration parameter are
7// candidates.
8
9struct B { template<typename T> B(T); };
10int operator~(B);
11template<typename T> int operator%(B, T);
12enum class E { e };
13
14template<typename T> int f(T t) { return ~t; } // expected-error {{invalid argument type}}
15template<typename T, typename U> int f(T t, U u) { return t % u; } // expected-error {{invalid operands to}}
16
17int b1 = ~E::e; // expected-error {{invalid argument type}}
18int b2 = f(E::e); // expected-note {{in instantiation of}}
19int b3 = f(0, E::e);
20int b4 = f(E::e, 0); // expected-note {{in instantiation of}}
21
22}
23
24namespace bullet3 {
25
26// This is specifically testing the bullet:
27// "do not have the same parameter-type-list as any non-template
28// non-member candidate."
29// The rest is sort of hard to test separately.
30
31enum E1 { one };
32enum E2 { two };
33
34struct A;
35
36A operator >= (E1, E1);
37A operator >= (E1, const E2);
38
39E1 a;
40E2 b;
41
42extern A test1;
43extern decltype(a >= a) test1;
44extern decltype(a >= b) test1;
45
46template <typename T> A operator <= (E1, T);
47extern bool test2;
48extern decltype(a <= a) test2;
49
50extern A test3;
51extern decltype(a <= b) test3;
52
53}
54