Date: Wed, 18 Jan 2023 13:36:47 -0500
On Wed, Jan 18, 2023 at 1:28 PM Robert Allan Schwartz via
Std-Proposals <std-proposals_at_[hidden]> wrote:
>
> Giuseppe,
>
> Does that mean the current code in <stop_token> will not compile under that draft?
Code in the standard isn't supposed to compile by itself.
The implementation must behave "as if" it were equivalent to the
declarations and behaviors specified by the standard. This means that
if you call `operator==` on `stop_token` and discard the result, the
behavior identified by the `[[nodiscard]]` attribute must happen.
Exactly how an implementation accomplishes that is up to themselves.
For example, the implementation could define the `operator==` function
at the cite of the declaration in `stop_token`. Or the declaration
could lack `[[nodiscard]]`, but the definition could have it (and the
standard is 100% fine with that; the behavior will happen so long as
the compiler can see it on one of the declarations).
Std-Proposals <std-proposals_at_[hidden]> wrote:
>
> Giuseppe,
>
> Does that mean the current code in <stop_token> will not compile under that draft?
Code in the standard isn't supposed to compile by itself.
The implementation must behave "as if" it were equivalent to the
declarations and behaviors specified by the standard. This means that
if you call `operator==` on `stop_token` and discard the result, the
behavior identified by the `[[nodiscard]]` attribute must happen.
Exactly how an implementation accomplishes that is up to themselves.
For example, the implementation could define the `operator==` function
at the cite of the declaration in `stop_token`. Or the declaration
could lack `[[nodiscard]]`, but the definition could have it (and the
standard is 100% fine with that; the behavior will happen so long as
the compiler can see it on one of the declarations).
Received on 2023-01-18 18:37:08