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

example in [dcl.attr.nodiscard]p3 is insufficiently clear #1470

Closed
zygoloid opened this issue Feb 16, 2017 · 1 comment
Closed

example in [dcl.attr.nodiscard]p3 is insufficiently clear #1470

zygoloid opened this issue Feb 16, 2017 · 1 comment
Assignees

Comments

@zygoloid
Copy link
Member

Reported by Mike:

In particular, the line that reads

 void f() { foo(); } // reference type, warning not encouraged

isn't clear enough why the warning is not encouraged. In fact, it's because the nodiscard attribute is on the class type referred to, not the function foo(), and the return type is not (cannot be) declared nodiscard. I'd suggest, if you agree, an editorial change to something like

 void f() { foo(); } // warning not encouraged: not a nodiscard call, because
                     // neither the (reference) return type nor the function is
                     // declared nodiscard

would clarify the intent.

This seems like an improvement to me.

jensmaurer added a commit to jensmaurer/draft that referenced this issue Feb 16, 2017
Add rationale why a warning is not encouraged for this case.

Fixes cplusplus#1470.
@jensmaurer
Copy link
Member

Here you are.

@jensmaurer jensmaurer self-assigned this Feb 16, 2017
zygoloid pushed a commit that referenced this issue Feb 23, 2017
Add rationale why a warning is not encouraged for this case.

Fixes #1470.
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

2 participants