[clang] [clang] Improve diagnostic on [[nodiscard]] attribute (PR #112521)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 16 11:33:23 PDT 2024
================
@@ -115,20 +115,20 @@ void usage() {
S('A'); // expected-warning {{ignoring temporary created by a constructor declared with 'nodiscard' attribute: Don't let that S-Char go!}}
S(1);
S(2.2);
- Y(); // expected-warning {{ignoring temporary created by a constructor declared with 'nodiscard' attribute: Don't throw me away either!}}
+ Y(); // expected-warning {{ignoring temporary of type 'Y' declared with 'nodiscard' attribute: Don't throw me away either!}}
S s;
- ConvertTo{}; // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute: Don't throw me away!}}
+ ConvertTo{}; // expected-warning {{ignoring return value of type 'ConvertTo' declared with 'nodiscard' attribute: Don't throw me away!}}
----------------
Sirraide wrote:
At a glance, that might be because it uses `{}` instead of `()`, but either way, that doesn’t matter anymore.
https://github.com/llvm/llvm-project/pull/112521
More information about the cfe-commits
mailing list