New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can we flatten the list in [dcl.init.ref]p5 #1750
Comments
@tkoeppe: The list seems a little less daunting these days, except that the last bullet could probably be un-nested. |
This can be made somewhat less confusing by moving the "If T1 is reference-related to T2" and its two bullets inside the previous bullet (5.4.2 currently). It does not apply to bullet 5.4.1 because that says "If [...] T1 is not reference-related to T2, [...]". But we don't want to convert 5.4.1 and 5.4.2 to higher-level bullets, because we think that the "In all cases except the last, [...]" wording below intends to refer to all of 5.4, and converting those bullets to being 5.4 and 5.5 would further obscure the meaning of that sentence. |
Is "bind directly" correctly defined? Consider this example (simplified from the example that follows [dcl.init.ref]/(5.3.2)): struct B { };
struct X {
operator B();
} x;
B&& rrb = x; // bound directly to the result of `operator B` This reference initialization matches 5.3.2, and so is considered as binding directly. But isn't it implicitly converting the initializer expression ( |
Ah, 5.3.2 uses [over.match.ref] while 5.4.1 uses [over.match.copy] or [over.match.conv]. So initialization by conversion function is "direct reference binding", while similar conversion by constructor is not 😕 struct B { B(struct X); };
struct X { } x;
B&& rrb = x; // bound indirectly |
The original problem has been addressed by converting some bullet nesting to an "otherwise, ill-formed" bullet. Further rework here seems possible, but should probably be conducted by CWG. |
Consider [dcl.init.ref]/(5.2.2.2), which is a list item containing a paragraph break. The entire nested list seems overly complex.
Suggestion from @zygoloid is to consider flattening the list by replacing nested "otherwise"s with "if not X, the program is ill-formed", which allows the subsequent conditions to appear at the same level of hierarchy.
The text was updated successfully, but these errors were encountered: