| 1 |
// P0847R7 |
| 2 |
// { dg-do compile { target c++23 } } |
| 3 |
|
| 4 |
// redeclarations of xobj member functions as static member functions and vice versa |
| 5 |
|
| 6 |
struct S { |
| 7 |
// no additional params |
| 8 |
void f_xs_v(this S) {}; // { dg-note {previous declaration} } |
| 9 |
static void f_xs_v() {}; // { dg-error {cannot be overloaded with} } |
| 10 |
|
| 11 |
void f_xs_ref(this S&) {}; // { dg-note {previous declaration} } |
| 12 |
static void f_xs_ref() {}; // { dg-error {cannot be overloaded with} } |
| 13 |
|
| 14 |
void f_xs_cref(this S const&) {}; // { dg-note {previous declaration} } |
| 15 |
static void f_xs_cref() {}; // { dg-error {cannot be overloaded with} } |
| 16 |
|
| 17 |
void f_xs_rref(this S&&) {}; // { dg-note {previous declaration} } |
| 18 |
static void f_xs_rref() {}; // { dg-error {cannot be overloaded with} } |
| 19 |
|
| 20 |
void f_xs_crref(this S const&&) {}; // { dg-note {previous declaration} } |
| 21 |
static void f_xs_crref() {}; // { dg-error {cannot be overloaded with} } |
| 22 |
|
| 23 |
// reversed |
| 24 |
static void f_sx_v() {}; // { dg-note {previous declaration} } |
| 25 |
void f_sx_v(this S) {}; // { dg-error {cannot be overloaded with} } |
| 26 |
|
| 27 |
static void f_sx_ref() {}; // { dg-note {previous declaration} } |
| 28 |
void f_sx_ref(this S&) {}; // { dg-error {cannot be overloaded with} } |
| 29 |
|
| 30 |
static void f_sx_cref() {}; // { dg-note {previous declaration} } |
| 31 |
void f_sx_cref(this S const&) {}; // { dg-error {cannot be overloaded with} } |
| 32 |
|
| 33 |
static void f_sx_rref() {}; // { dg-note {previous declaration} } |
| 34 |
void f_sx_rref(this S&&) {}; // { dg-error {cannot be overloaded with} } |
| 35 |
|
| 36 |
static void f_sx_crref() {}; // { dg-note {previous declaration} } |
| 37 |
void f_sx_crref(this S const&&) {}; // { dg-error {cannot be overloaded with} } |
| 38 |
|
| 39 |
// one additional param |
| 40 |
void f_xs_v_int(this S, int) {}; // { dg-note {previous declaration} } |
| 41 |
static void f_xs_v_int(int) {}; // { dg-error {cannot be overloaded with} } |
| 42 |
|
| 43 |
void f_xs_ref_int(this S&, int) {}; // { dg-note {previous declaration} } |
| 44 |
static void f_xs_ref_int(int) {}; // { dg-error {cannot be overloaded with} } |
| 45 |
|
| 46 |
void f_xs_cref_int(this S const&, int) {}; // { dg-note {previous declaration} } |
| 47 |
static void f_xs_cref_int(int) {}; // { dg-error {cannot be overloaded with} } |
| 48 |
|
| 49 |
void f_xs_rref_int(this S&&, int) {}; // { dg-note {previous declaration} } |
| 50 |
static void f_xs_rref_int(int) {}; // { dg-error {cannot be overloaded with} } |
| 51 |
|
| 52 |
void f_xs_crref_int(this S const&&, int) {}; // { dg-note {previous declaration} } |
| 53 |
static void f_xs_crref_int(int) {}; // { dg-error {cannot be overloaded with} } |
| 54 |
|
| 55 |
// reversed |
| 56 |
static void f_sx_v_int(int) {}; // { dg-note {previous declaration} } |
| 57 |
void f_sx_v_int(this S, int) {}; // { dg-error {cannot be overloaded with} } |
| 58 |
|
| 59 |
static void f_sx_ref_int(int) {}; // { dg-note {previous declaration} } |
| 60 |
void f_sx_ref_int(this S&, int) {}; // { dg-error {cannot be overloaded with} } |
| 61 |
|
| 62 |
static void f_sx_cref_int(int) {}; // { dg-note {previous declaration} } |
| 63 |
void f_sx_cref_int(this S const&, int) {}; // { dg-error {cannot be overloaded with} } |
| 64 |
|
| 65 |
static void f_sx_rref_int(int) {}; // { dg-note {previous declaration} } |
| 66 |
void f_sx_rref_int(this S&&, int) {}; // { dg-error {cannot be overloaded with} } |
| 67 |
|
| 68 |
static void f_sx_crref_int(int) {}; // { dg-note {previous declaration} } |
| 69 |
void f_sx_crref_int(this S const&&, int) {}; // { dg-error {cannot be overloaded with} } |
| 70 |
|
| 71 |
// two additional params |
| 72 |
void f_xs_v_int2(this S, int, int) {}; // { dg-note {previous declaration} } |
| 73 |
static void f_xs_v_int2(int, int) {}; // { dg-error {cannot be overloaded with} } |
| 74 |
|
| 75 |
void f_xs_ref_int2(this S&, int, int) {}; // { dg-note {previous declaration} } |
| 76 |
static void f_xs_ref_int2(int, int) {}; // { dg-error {cannot be overloaded with} } |
| 77 |
|
| 78 |
void f_xs_cref_int2(this S const&, int, int) {}; // { dg-note {previous declaration} } |
| 79 |
static void f_xs_cref_int2(int, int) {}; // { dg-error {cannot be overloaded with} } |
| 80 |
|
| 81 |
void f_xs_rref_int2(this S&&, int, int) {}; // { dg-note {previous declaration} } |
| 82 |
static void f_xs_rref_int2(int, int) {}; // { dg-error {cannot be overloaded with} } |
| 83 |
|
| 84 |
void f_xs_crref_int2(this S const&&, int, int) {}; // { dg-note {previous declaration} } |
| 85 |
static void f_xs_crref_int2(int, int) {}; // { dg-error {cannot be overloaded with} } |
| 86 |
|
| 87 |
// reversed |
| 88 |
static void f_sx_v_int2(int, int) {}; // { dg-note {previous declaration} } |
| 89 |
void f_sx_v_int2(this S, int, int) {}; // { dg-error {cannot be overloaded with} } |
| 90 |
|
| 91 |
static void f_sx_ref_int2(int, int) {}; // { dg-note {previous declaration} } |
| 92 |
void f_sx_ref_int2(this S&, int, int) {}; // { dg-error {cannot be overloaded with} } |
| 93 |
|
| 94 |
static void f_sx_cref_int2(int, int) {}; // { dg-note {previous declaration} } |
| 95 |
void f_sx_cref_int2(this S const&, int, int) {}; // { dg-error {cannot be overloaded with} } |
| 96 |
|
| 97 |
static void f_sx_rref_int2(int, int) {}; // { dg-note {previous declaration} } |
| 98 |
void f_sx_rref_int2(this S&&, int, int) {}; // { dg-error {cannot be overloaded with} } |
| 99 |
|
| 100 |
static void f_sx_crref_int2(int, int) {}; // { dg-note {previous declaration} } |
| 101 |
void f_sx_crref_int2(this S const&&, int, int) {}; // { dg-error {cannot be overloaded with} } |
| 102 |
}; |
| 103 |
|
| 104 |
// unrelated explicit object parameter type |
| 105 |
|
| 106 |
struct A {}; |
| 107 |
|
| 108 |
struct S1 |
| 109 |
{ |
| 110 |
// no additional params |
| 111 |
void f_xs_v(this A) {}; // { dg-note {previous declaration} } |
| 112 |
static void f_xs_v() {}; // { dg-error {cannot be overloaded with} } |
| 113 |
|
| 114 |
void f_xs_ref(this A&) {}; // { dg-note {previous declaration} } |
| 115 |
static void f_xs_ref() {}; // { dg-error {cannot be overloaded with} } |
| 116 |
|
| 117 |
void f_xs_cref(this A const&) {}; // { dg-note {previous declaration} } |
| 118 |
static void f_xs_cref() {}; // { dg-error {cannot be overloaded with} } |
| 119 |
|
| 120 |
void f_xs_rref(this A&&) {}; // { dg-note {previous declaration} } |
| 121 |
static void f_xs_rref() {}; // { dg-error {cannot be overloaded with} } |
| 122 |
|
| 123 |
void f_xs_crref(this A const&&) {}; // { dg-note {previous declaration} } |
| 124 |
static void f_xs_crref() {}; // { dg-error {cannot be overloaded with} } |
| 125 |
|
| 126 |
// reversed |
| 127 |
static void f_sx_v() {}; // { dg-note {previous declaration} } |
| 128 |
void f_sx_v(this A) {}; // { dg-error {cannot be overloaded with} } |
| 129 |
|
| 130 |
static void f_sx_ref() {}; // { dg-note {previous declaration} } |
| 131 |
void f_sx_ref(this A&) {}; // { dg-error {cannot be overloaded with} } |
| 132 |
|
| 133 |
static void f_sx_cref() {}; // { dg-note {previous declaration} } |
| 134 |
void f_sx_cref(this A const&) {}; // { dg-error {cannot be overloaded with} } |
| 135 |
|
| 136 |
static void f_sx_rref() {}; // { dg-note {previous declaration} } |
| 137 |
void f_sx_rref(this A&&) {}; // { dg-error {cannot be overloaded with} } |
| 138 |
|
| 139 |
static void f_sx_crref() {}; // { dg-note {previous declaration} } |
| 140 |
void f_sx_crref(this A const&&) {}; // { dg-error {cannot be overloaded with} } |
| 141 |
|
| 142 |
// one additional param |
| 143 |
void f_xs_v_int(this A, int) {}; // { dg-note {previous declaration} } |
| 144 |
static void f_xs_v_int(int) {}; // { dg-error {cannot be overloaded with} } |
| 145 |
|
| 146 |
void f_xs_ref_int(this A&, int) {}; // { dg-note {previous declaration} } |
| 147 |
static void f_xs_ref_int(int) {}; // { dg-error {cannot be overloaded with} } |
| 148 |
|
| 149 |
void f_xs_cref_int(this A const&, int) {}; // { dg-note {previous declaration} } |
| 150 |
static void f_xs_cref_int(int) {}; // { dg-error {cannot be overloaded with} } |
| 151 |
|
| 152 |
void f_xs_rref_int(this A&&, int) {}; // { dg-note {previous declaration} } |
| 153 |
static void f_xs_rref_int(int) {}; // { dg-error {cannot be overloaded with} } |
| 154 |
|
| 155 |
void f_xs_crref_int(this A const&&, int) {}; // { dg-note {previous declaration} } |
| 156 |
static void f_xs_crref_int(int) {}; // { dg-error {cannot be overloaded with} } |
| 157 |
|
| 158 |
// reversed |
| 159 |
static void f_sx_v_int(int) {}; // { dg-note {previous declaration} } |
| 160 |
void f_sx_v_int(this A, int) {}; // { dg-error {cannot be overloaded with} } |
| 161 |
|
| 162 |
static void f_sx_ref_int(int) {}; // { dg-note {previous declaration} } |
| 163 |
void f_sx_ref_int(this A&, int) {}; // { dg-error {cannot be overloaded with} } |
| 164 |
|
| 165 |
static void f_sx_cref_int(int) {}; // { dg-note {previous declaration} } |
| 166 |
void f_sx_cref_int(this A const&, int) {}; // { dg-error {cannot be overloaded with} } |
| 167 |
|
| 168 |
static void f_sx_rref_int(int) {}; // { dg-note {previous declaration} } |
| 169 |
void f_sx_rref_int(this A&&, int) {}; // { dg-error {cannot be overloaded with} } |
| 170 |
|
| 171 |
static void f_sx_crref_int(int) {}; // { dg-note {previous declaration} } |
| 172 |
void f_sx_crref_int(this A const&&, int) {}; // { dg-error {cannot be overloaded with} } |
| 173 |
|
| 174 |
// two additional params |
| 175 |
void f_xs_v_int2(this A, int, int) {}; // { dg-note {previous declaration} } |
| 176 |
static void f_xs_v_int2(int, int) {}; // { dg-error {cannot be overloaded with} } |
| 177 |
|
| 178 |
void f_xs_ref_int2(this A&, int, int) {}; // { dg-note {previous declaration} } |
| 179 |
static void f_xs_ref_int2(int, int) {}; // { dg-error {cannot be overloaded with} } |
| 180 |
|
| 181 |
void f_xs_cref_int2(this A const&, int, int) {}; // { dg-note {previous declaration} } |
| 182 |
static void f_xs_cref_int2(int, int) {}; // { dg-error {cannot be overloaded with} } |
| 183 |
|
| 184 |
void f_xs_rref_int2(this A&&, int, int) {}; // { dg-note {previous declaration} } |
| 185 |
static void f_xs_rref_int2(int, int) {}; // { dg-error {cannot be overloaded with} } |
| 186 |
|
| 187 |
void f_xs_crref_int2(this A const&&, int, int) {}; // { dg-note {previous declaration} } |
| 188 |
static void f_xs_crref_int2(int, int) {}; // { dg-error {cannot be overloaded with} } |
| 189 |
|
| 190 |
// reversed |
| 191 |
static void f_sx_v_int2(int, int) {}; // { dg-note {previous declaration} } |
| 192 |
void f_sx_v_int2(this A, int, int) {}; // { dg-error {cannot be overloaded with} } |
| 193 |
|
| 194 |
static void f_sx_ref_int2(int, int) {}; // { dg-note {previous declaration} } |
| 195 |
void f_sx_ref_int2(this A&, int, int) {}; // { dg-error {cannot be overloaded with} } |
| 196 |
|
| 197 |
static void f_sx_cref_int2(int, int) {}; // { dg-note {previous declaration} } |
| 198 |
void f_sx_cref_int2(this A const&, int, int) {}; // { dg-error {cannot be overloaded with} } |
| 199 |
|
| 200 |
static void f_sx_rref_int2(int, int) {}; // { dg-note {previous declaration} } |
| 201 |
void f_sx_rref_int2(this A&&, int, int) {}; // { dg-error {cannot be overloaded with} } |
| 202 |
|
| 203 |
static void f_sx_crref_int2(int, int) {}; // { dg-note {previous declaration} } |
| 204 |
void f_sx_crref_int2(this A const&&, int, int) {}; // { dg-error {cannot be overloaded with} } |
| 205 |
}; |
| 206 |
|