Created on 2023-08-09.00:00:00 last changed 1 month ago
Possible resolution:
Add a note in 6.4.1 [basic.scope.scope] paragraph 4 as follows:
[ Note: Two function declarations with different ref-qualifiers or parameter-type-lists do not have the same type even if they correspond (6.7 [basic.link]). -- end note ]
[ Example 2:typedef int Int; ... void m(); void n(); }; X::m() & {} // error: redeclaration of X::m with a different type X::n(this X&) {} // error: redeclaration of X::n with a different type
Consider:
struct S {
void f() &;
};
void S::f(this S&) {}
Both declarations of S::f correspond (6.4.1 [basic.scope.scope] paragraph 4), but are ill-formed according to 6.7 [basic.link] paragraph 1, because the functions are not of the same type:
For any two declarations of an entity E:
- If one declares E to be a variable or function, the other shall declare E as one of the same type.
- ...
A similar situation arises for the following example:
struct S {
void g() &;
};
void S::g() { }
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2025-11-06 23:04:52 | admin | set | messages: + msg8260 |
| 2023-08-09 00:00:00 | admin | create | |