Title
Discarding a void return value
Status
open
Section
9.12.10 [dcl.attr.nodiscard]
Submitter
Brian Bi

Created on 2024-10-24.00:00:00 last changed 3 weeks ago

Messages

Date: 2024-10-26.20:39:24

Suggested resolution:

Change in 9.12.10 [dcl.attr.nodiscard] paragraph 4 as follows:

Recommended practice: Appearance of a nodiscard call as a potentially-evaluated discarded-value expression (7.2 [expr.prop]) of non-void type is discouraged unless explicitly cast to void. Implementations should issue a warning in such cases. The value of a has-attribute-expression for the nodiscard attribute should be 0 unless the implementation can issue such warnings.
Date: 2024-10-24.00:00:00

(From submission #628.)

A warning is currently, but ought not to be, encouraged for a call to a [[nodiscard]] function with a void return type. Such a situation may arise for dependent return types.

History
Date User Action Args
2024-10-26 20:39:24adminsetmessages: + msg7861
2024-10-24 00:00:00admincreate