Skip to content
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

[class.temporary]p6: "should" in note #1674

Closed
zygoloid opened this issue Jul 19, 2017 · 2 comments
Closed

[class.temporary]p6: "should" in note #1674

zygoloid opened this issue Jul 19, 2017 · 2 comments
Assignees

Comments

@zygoloid
Copy link
Member

Bullet 6.11 says:

A temporary bound to a reference in a new-initializer (8.3.4) persists until the completion of the full-expression containing the new-initializer. [Example:

struct S { int mi; const std::pair<int,int>& mp; };
S a { 1, {2,3} };
S* p = new S{ 1, {2,3} }; // Creates dangling reference

end example ] [ Note: This may introduce a dangling reference, and implementations should issue a warning in such a case. — end note ]

Even if this note were sound advice (it is not in all cases: such a warning may have false positives if the allocation is consumed before the full-expression ends), providing normative encouragement via "should" in a note is verboten (ISO Directives, part 2, 7th ed, 24.5).

@tkoeppe
Copy link
Contributor

tkoeppe commented Jul 19, 2017

Demote to footnote?

@hubert-reinterpretcast
Copy link
Contributor

Footnotes are similarly restricted (ISO Directives, part 2, 7th ed., 26.5).

jensmaurer added a commit to jensmaurer/draft that referenced this issue Jul 21, 2017
And move the surviving part of the note to before the
corresponding example.

Fixes cplusplus#1674.
@jensmaurer jensmaurer self-assigned this Jul 21, 2017
zygoloid pushed a commit that referenced this issue Jul 30, 2017
And move the surviving part of the note to before the
corresponding example.

Fixes #1674.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants