Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / over / over.load / p2-0x.cpp
blob183f3cb322af7e7e12de1f6bec9275f71dd54f2f
1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s
4 // Member function declarations with the same name and the same
5 // parameter-type-list as well as mem- ber function template
6 // declarations with the same name, the same parameter-type-list, and
7 // the same template parameter lists cannot be overloaded if any of
8 // them, but not all, have a ref-qualifier (8.3.5).
10 class Y {
11 void h() &;
12 void h() const &;
13 void h() &&;
14 void i() &; // expected-note{{previous declaration}}
15 void i() const; // expected-error{{cannot overload a member function without a ref-qualifier with a member function with ref-qualifier '&'}}
17 template<typename T> void f(T*) &;
18 template<typename T> void f(T*) &&;
20 template<typename T> void g(T*) &; // expected-note{{previous declaration}}
21 template<typename T> void g(T*); // expected-error{{cannot overload a member function without a ref-qualifier with a member function with ref-qualifier '&'}}
23 void k(); // expected-note{{previous declaration}}
24 void k() &&; // expected-error{{cannot overload a member function with ref-qualifier '&&' with a member function without a ref-qualifier}}
28 #if __cplusplus >= 202002L
29 namespace GH58962 {
31 template<typename T>
32 __add_rvalue_reference(T) declval();
34 template<unsigned R>
35 struct type
37 void func() requires (R == 0);
38 void func() & requires (R == 1);
39 void func() && requires (R == 2);
42 template<typename T>
43 concept test = requires { declval<T>().func(); };
45 static_assert(test<type<0>&>);
46 static_assert(test<type<0>&&>);
47 static_assert(test<type<1>&>);
48 static_assert(not test<type<1>&&>);
49 static_assert(not test<type<2>&>);
50 static_assert(test<type<2>&&>);
53 #endif