1 | // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s |
2 | |
3 | // Member function declarations with the same name and the same |
4 | // parameter-type-list as well as mem- ber function template |
5 | // declarations with the same name, the same parameter-type-list, and |
6 | // the same template parameter lists cannot be overloaded if any of |
7 | // them, but not all, have a ref-qualifier (8.3.5). |
8 | |
9 | class Y { |
10 | void h() &; |
11 | void h() const &; |
12 | void h() &&; |
13 | void i() &; // expected-note{{previous declaration}} |
14 | void i() const; // expected-error{{cannot overload a member function without a ref-qualifier with a member function with ref-qualifier '&'}} |
15 | |
16 | template<typename T> void f(T*) &; |
17 | template<typename T> void f(T*) &&; |
18 | |
19 | template<typename T> void g(T*) &; // expected-note{{previous declaration}} |
20 | template<typename T> void g(T*); // expected-error{{cannot overload a member function without a ref-qualifier with a member function with ref-qualifier '&'}} |
21 | |
22 | void k(); // expected-note{{previous declaration}} |
23 | void k() &&; // expected-error{{cannot overload a member function with ref-qualifier '&&' with a member function without a ref-qualifier}} |
24 | }; |
25 | |