Created on 2021-10-26.00:00:00 last changed 25 months ago
CWG 2022-11-10
CWG believes that, in general, a "when needed" approach to parsing complete-class contexts is superior. In the present case, the existing wording clearly requires that the noexcept-specifier be delayed-parsed, which implies that matching the declaration of a friend function to declarations at namespace scope is also delayed.
Notes from the December, 2021 teleconference:
CWG questioned why the declaration matching couldn't be deferred until the end of the class.
According to 11.4.1 [class.mem.general] paragraph 7, a noexcept-specifier is a complete-class context. This raises an issue when the function is a friend function; for example, consider:
using T = int; struct B { friend void g(B b) noexcept(sizeof(b.m) >= 4) { } T m = T(); }; int main() { B b; g(b); }
For friend declarations you need to be able to decide at the point of declaration whether it matches a prior declaration, and you can't do that if you treat the noexcept-specifier as a complete-class context.
There is implementation divergence in the treatment of this example.
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-11-11 15:53:10 | admin | set | messages: + msg7022 |
2022-11-11 15:53:10 | admin | set | status: open -> nad |
2022-01-06 00:00:00 | admin | set | messages: + msg6618 |
2021-10-26 00:00:00 | admin | create |