From Jason Turner

[dcl.attr.nodiscard]

Diff to HTML by rtfpessoa

tmp/tmpvcmj79ig/{from.md → to.md} RENAMED
@@ -4,11 +4,11 @@ The *attribute-token* `nodiscard` may be applied to a function or a
4
  lambda call operator or to the declaration of a class or enumeration. An
5
  *attribute-argument-clause* may be present and, if present, shall have
6
  the form:
7
 
8
  ``` bnf
9
- '(' string-literal ')'
10
  ```
11
 
12
  A name or entity declared without the `nodiscard` attribute can later be
13
  redeclared with the attribute and vice-versa.
14
 
@@ -33,20 +33,22 @@ is either
33
  constructs an object through a constructor declared `nodiscard` in a
34
  reachable declaration, or that initializes an object of a nodiscard
35
  type.
36
 
37
  *Recommended practice:* Appearance of a nodiscard call as a
38
- potentially-evaluated discarded-value expression [[expr.prop]] is
39
- discouraged unless explicitly cast to `void`. Implementations should
40
- issue a warning in such cases.
 
 
41
 
42
  [*Note 2*: This is typically because discarding the return value of a
43
  nodiscard call has surprising consequences. — *end note*]
44
 
45
- The *string-literal* in a `nodiscard` *attribute-argument-clause* should
46
- be used in the message of the warning as the rationale for why the
47
- result should not be discarded.
48
 
49
  [*Example 1*:
50
 
51
  ``` cpp
52
  struct [[nodiscard]] my_scopeguard { ... };
 
4
  lambda call operator or to the declaration of a class or enumeration. An
5
  *attribute-argument-clause* may be present and, if present, shall have
6
  the form:
7
 
8
  ``` bnf
9
+ '(' unevaluated-string ')'
10
  ```
11
 
12
  A name or entity declared without the `nodiscard` attribute can later be
13
  redeclared with the attribute and vice-versa.
14
 
 
33
  constructs an object through a constructor declared `nodiscard` in a
34
  reachable declaration, or that initializes an object of a nodiscard
35
  type.
36
 
37
  *Recommended practice:* Appearance of a nodiscard call as a
38
+ potentially-evaluated discarded-value expression [[expr.prop]] of
39
+ non-void type is discouraged unless explicitly cast to `void`.
40
+ Implementations should issue a warning in such cases. The value of a
41
+ *has-attribute-expression* for the `nodiscard` attribute should be `0`
42
+ unless the implementation can issue such warnings.
43
 
44
  [*Note 2*: This is typically because discarding the return value of a
45
  nodiscard call has surprising consequences. — *end note*]
46
 
47
+ The *unevaluated-string* in a `nodiscard` *attribute-argument-clause*
48
+ should be used in the message of the warning as the rationale for why
49
+ the result should not be discarded.
50
 
51
  [*Example 1*:
52
 
53
  ``` cpp
54
  struct [[nodiscard]] my_scopeguard { ... };