// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s // Member function declarations with the same name and the same // parameter-type-list as well as mem- ber function template // declarations with the same name, the same parameter-type-list, and // the same template parameter lists cannot be overloaded if any of // them, but not all, have a ref-qualifier (8.3.5). class Y { void h() &; void h() const &; void h() &&; void i() &; // expected-note{{previous declaration}} void i() const; // expected-error{{cannot overload a member function without a ref-qualifier with a member function with ref-qualifier '&'}} template void f(T*) &; template void f(T*) &&; template void g(T*) &; // expected-note{{previous declaration}} template void g(T*); // expected-error{{cannot overload a member function without a ref-qualifier with a member function with ref-qualifier '&'}} void k(); // expected-note{{previous declaration}} void k() &&; // expected-error{{cannot overload a member function with ref-qualifier '&&' with a member function without a ref-qualifier}} }; struct GH76358 { template void f() && {} template void f() const {} }; #if __cplusplus >= 202002L namespace GH58962 { template __add_rvalue_reference(T) declval(); template struct type { void func() requires (R == 0); void func() & requires (R == 1); void func() && requires (R == 2); }; template concept test = requires { declval().func(); }; static_assert(test&>); static_assert(test&&>); static_assert(test&>); static_assert(not test&&>); static_assert(not test&>); static_assert(test&&>); } namespace GH78101 { template concept True = true; template struct Template { static constexpr int i = I; friend constexpr auto operator+(True auto f) { return i; } }; template struct Template { static constexpr int i = I; friend constexpr auto operator+(True auto f) { return i; } }; Template f{}; static_assert(+Template{} == 5); } #endif