diff --git a/source/declarations.tex b/source/declarations.tex index d4302e71cd..ef49e7a8ce 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -9238,7 +9238,7 @@ \pnum \begin{example} \begin{codeblock} -struct [[nodiscard]] my_scopeguard { @\commentellip@ }; +struct [[nodiscard("discarding guards is a bug")]] my_scopeguard { @\commentellip@ }; struct my_unique { my_unique() = default; // does not acquire resource [[nodiscard]] my_unique(int fd) { @\commentellip@ } // acquires resource @@ -9249,7 +9249,7 @@ error_info enable_missile_safety_mode(); void launch_missiles(); void test_missiles() { - my_scopeguard(); // warning encouraged + my_scopeguard(); // warning encouraged; should include "discarding guards is a bug" (void)my_scopeguard(), // warning not encouraged, cast to \keyword{void} launch_missiles(); // comma operator, statement continues my_unique(42); // warning encouraged