xref: /minix3/external/bsd/llvm/dist/clang/test/SemaTemplate/operator-function-id-template.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc // expected-no-diagnostics
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc template<typename T>
5*f4a2713aSLionel Sambuc struct A {
6*f4a2713aSLionel Sambuc   template<typename U> A<T> operator+(U);
7*f4a2713aSLionel Sambuc };
8*f4a2713aSLionel Sambuc 
9*f4a2713aSLionel Sambuc template<int Value, typename T> bool operator==(A<T>, A<T>);
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc template<> bool operator==<0>(A<int>, A<int>);
12*f4a2713aSLionel Sambuc 
test_qualified_id(A<int> ai)13*f4a2713aSLionel Sambuc bool test_qualified_id(A<int> ai) {
14*f4a2713aSLionel Sambuc   return ::operator==<0, int>(ai, ai);
15*f4a2713aSLionel Sambuc }
16*f4a2713aSLionel Sambuc 
test_op(A<int> a,int i)17*f4a2713aSLionel Sambuc void test_op(A<int> a, int i) {
18*f4a2713aSLionel Sambuc   const A<int> &air = a.operator+<int>(i);
19*f4a2713aSLionel Sambuc }
20*f4a2713aSLionel Sambuc 
21*f4a2713aSLionel Sambuc template<typename T>
test_op_template(A<T> at,T x)22*f4a2713aSLionel Sambuc void test_op_template(A<T> at, T x) {
23*f4a2713aSLionel Sambuc   const A<T> &atr = at.template operator+<T>(x);
24*f4a2713aSLionel Sambuc   const A<T> &atr2 = at.A::template operator+<T>(x);
25*f4a2713aSLionel Sambuc   // FIXME: unrelated template-name instantiation issue
26*f4a2713aSLionel Sambuc   //  const A<T> &atr3 = at.template A<T>::template operator+<T>(x);
27*f4a2713aSLionel Sambuc }
28*f4a2713aSLionel Sambuc 
29*f4a2713aSLionel Sambuc template void test_op_template<float>(A<float>, float);
30