operator-function-id-template.cpp 762 B

1234567891011121314151617181920212223242526272829
  1. // RUN: %clang_cc1 -fsyntax-only -verify %s
  2. // expected-no-diagnostics
  3. template<typename T>
  4. struct A {
  5. template<typename U> A<T> operator+(U);
  6. };
  7. template<int Value, typename T> bool operator==(A<T>, A<T>);
  8. template<> bool operator==<0>(A<int>, A<int>);
  9. bool test_qualified_id(A<int> ai) {
  10. return ::operator==<0, int>(ai, ai);
  11. }
  12. void test_op(A<int> a, int i) {
  13. const A<int> &air = a.operator+<int>(i);
  14. }
  15. template<typename T>
  16. void test_op_template(A<T> at, T x) {
  17. const A<T> &atr = at.template operator+<T>(x);
  18. const A<T> &atr2 = at.A::template operator+<T>(x);
  19. // FIXME: unrelated template-name instantiation issue
  20. // const A<T> &atr3 = at.template A<T>::template operator+<T>(x);
  21. }
  22. template void test_op_template<float>(A<float>, float);