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