a function call expression ([expr.call])
that calls a function declared nodiscard in a reachable declaration or
whose return type is a nodiscard type, or
an explicit type
conversion ([expr.type.conv], [expr.static.cast], [expr.cast])
that constructs an object through
a constructor declared nodiscard in a reachable declaration, or
that initializes an object of a nodiscard type.
Recommended practice: Appearance of a nodiscard call as
a potentially-evaluated discarded-value expression ([expr.prop])
is discouraged unless explicitly cast to void.
Implementations should issue a warning in such cases.
This is typically because discarding the return value
of a nodiscard call has surprising consequences.
— end note]
The string-literal
in a nodiscardattribute-argument-clause
should be used in the message of the warning
as the rationale for why the result should not be discarded.