| 1 |
// P0847R7 |
| 2 |
// { dg-do compile { target c++23 } } |
| 3 |
|
| 4 |
// redeclarations with equivalent constraints |
| 5 |
|
| 6 |
template<typename T> |
| 7 |
concept Constrain = true; |
| 8 |
|
| 9 |
|
| 10 |
struct S { |
| 11 |
// xobj/static |
| 12 |
void f_xs_v(this S, Constrain auto) {}; // { dg-note {previous declaration} } |
| 13 |
static void f_xs_v(Constrain auto) {}; // { dg-error {cannot be overloaded with} } |
| 14 |
|
| 15 |
void f_xs_ref(this S&, Constrain auto) {}; // { dg-note {previous declaration} } |
| 16 |
static void f_xs_ref(Constrain auto) {}; // { dg-error {cannot be overloaded with} } |
| 17 |
|
| 18 |
void f_xs_cref(this S const&, Constrain auto) {}; // { dg-note {previous declaration} } |
| 19 |
static void f_xs_cref(Constrain auto) {}; // { dg-error {cannot be overloaded with} } |
| 20 |
|
| 21 |
void f_xs_rref(this S&&, Constrain auto) {}; // { dg-note {previous declaration} } |
| 22 |
static void f_xs_rref(Constrain auto) {}; // { dg-error {cannot be overloaded with} } |
| 23 |
|
| 24 |
void f_xs_crref(this S const&&, Constrain auto) {}; // { dg-note {previous declaration} } |
| 25 |
static void f_xs_crref(Constrain auto) {}; // { dg-error {cannot be overloaded with} } |
| 26 |
|
| 27 |
// static/xobj |
| 28 |
static void f_sx_v(Constrain auto) {}; // { dg-note {previous declaration} } |
| 29 |
void f_sx_v(this S, Constrain auto) {}; // { dg-error {cannot be overloaded with} } |
| 30 |
|
| 31 |
static void f_sx_ref(Constrain auto) {}; // { dg-note {previous declaration} } |
| 32 |
void f_sx_ref(this S&, Constrain auto) {}; // { dg-error {cannot be overloaded with} } |
| 33 |
|
| 34 |
static void f_sx_cref(Constrain auto) {}; // { dg-note {previous declaration} } |
| 35 |
void f_sx_cref(this S const&, Constrain auto) {}; // { dg-error {cannot be overloaded with} } |
| 36 |
|
| 37 |
static void f_sx_rref(Constrain auto) {}; // { dg-note {previous declaration} } |
| 38 |
void f_sx_rref(this S&&, Constrain auto) {}; // { dg-error {cannot be overloaded with} } |
| 39 |
|
| 40 |
static void f_sx_crref(Constrain auto) {}; // { dg-note {previous declaration} } |
| 41 |
void f_sx_crref(this S const&&, Constrain auto) {}; // { dg-error {cannot be overloaded with} } |
| 42 |
|
| 43 |
// iobj/xobj |
| 44 |
void f_ix_lref(Constrain auto) {}; // { dg-note {previous declaration} } |
| 45 |
void f_ix_lref(this S&, Constrain auto) {}; // { dg-error {cannot be overloaded with} } |
| 46 |
|
| 47 |
void f_ix_rref(Constrain auto) {}; // { dg-note {previous declaration} } |
| 48 |
void f_ix_rref(this S&&, Constrain auto) {}; // { dg-error {cannot be overloaded with} } |
| 49 |
|
| 50 |
void f_ix_const_lref(Constrain auto) const {}; // { dg-note {previous declaration} } |
| 51 |
void f_ix_const_lref(this S const&, Constrain auto) {}; // { dg-error {cannot be overloaded with} } |
| 52 |
|
| 53 |
void f_ix_const_rref(Constrain auto) const {}; // { dg-note {previous declaration} } |
| 54 |
void f_ix_const_rref(this S const&&, Constrain auto) {}; // { dg-error {cannot be overloaded with} } |
| 55 |
|
| 56 |
// xobj/iobj |
| 57 |
void f_xi_lref(this S&, Constrain auto) {}; // { dg-note {previous declaration} } |
| 58 |
void f_xi_lref(Constrain auto) {}; // { dg-error {cannot be overloaded with} } |
| 59 |
|
| 60 |
void f_xi_rref(this S&&, Constrain auto) {}; // { dg-note {previous declaration} } |
| 61 |
void f_xi_rref(Constrain auto) {}; // { dg-error {cannot be overloaded with} } |
| 62 |
|
| 63 |
void f_xi_const_lref(this S const&, Constrain auto) {}; // { dg-note {previous declaration} } |
| 64 |
void f_xi_const_lref(Constrain auto) const {}; // { dg-error {cannot be overloaded with} } |
| 65 |
|
| 66 |
void f_xi_const_rref(this S const&&, Constrain auto) {}; // { dg-note {previous declaration} } |
| 67 |
void f_xi_const_rref(Constrain auto) const {}; // { dg-error {cannot be overloaded with} } |
| 68 |
|
| 69 |
// with ref qualifier |
| 70 |
|
| 71 |
// iobj/xobj |
| 72 |
void f_ix_lref_refqual(Constrain auto) & {}; // { dg-note {previous declaration} } |
| 73 |
void f_ix_lref_refqual(this S&, Constrain auto) {}; // { dg-error {cannot be overloaded with} } |
| 74 |
|
| 75 |
void f_ix_rref_refqual(Constrain auto) && {}; // { dg-note {previous declaration} } |
| 76 |
void f_ix_rref_refqual(this S&&, Constrain auto) {}; // { dg-error {cannot be overloaded with} } |
| 77 |
|
| 78 |
void f_ix_const_lref_refqual(Constrain auto) const& {}; // { dg-note {previous declaration} } |
| 79 |
void f_ix_const_lref_refqual(this S const&, Constrain auto) {}; // { dg-error {cannot be overloaded with} } |
| 80 |
|
| 81 |
void f_ix_const_rref_refqual(Constrain auto) const&& {}; // { dg-note {previous declaration} } |
| 82 |
void f_ix_const_rref_refqual(this S const&&, Constrain auto) {}; // { dg-error {cannot be overloaded with} } |
| 83 |
|
| 84 |
// xobj/iobj |
| 85 |
void f_xi_lref_refqual(this S&, Constrain auto) {}; // { dg-note {previous declaration} } |
| 86 |
void f_xi_lref_refqual(Constrain auto) & {}; // { dg-error {cannot be overloaded with} } |
| 87 |
|
| 88 |
void f_xi_rref_refqual(this S&&, Constrain auto) {}; // { dg-note {previous declaration} } |
| 89 |
void f_xi_rref_refqual(Constrain auto) && {}; // { dg-error {cannot be overloaded with} } |
| 90 |
|
| 91 |
void f_xi_const_lref_refqual(this S const&, Constrain auto) {}; // { dg-note {previous declaration} } |
| 92 |
void f_xi_const_lref_refqual(Constrain auto) const& {}; // { dg-error {cannot be overloaded with} } |
| 93 |
|
| 94 |
void f_xi_const_rref_refqual(this S const&&, Constrain auto) {}; // { dg-note {previous declaration} } |
| 95 |
void f_xi_const_rref_refqual(Constrain auto) const&& {}; // { dg-error {cannot be overloaded with} } |
| 96 |
}; |
| 97 |
|