public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "gcc at bobbyperu dot info" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/66177] New: warn_unused_result doesn't always work Date: Sat, 16 May 2015 15:00:00 -0000 [thread overview] Message-ID: <bug-66177-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66177 Bug ID: 66177 Summary: warn_unused_result doesn't always work Product: gcc Version: 4.9.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gcc at bobbyperu dot info Target Milestone: --- Testcase fails to work with gcc, works with clang. ===== struct QSize { QSize(int w, int h) : wd(w), ht(h) {} QSize expandedTo() const __attribute__ ((__warn_unused_result__)) { return QSize(2, 3); } private: int wd; int ht; }; void foo() { QSize sz(2, 2); sz.expandedTo(); } ===== $ g++ testcase.cpp -c -Wunused-result $ clang++ testcase.cpp -c -Wunused-result testcase.cpp:18:5: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result] sz.expandedTo(); ^~~~~~~~~~~~~ 1 warning generated.
next reply other threads:[~2015-05-16 15:00 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-05-16 15:00 gcc at bobbyperu dot info [this message] 2015-05-16 15:23 ` [Bug c++/66177] " gcc at bobbyperu dot info
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-66177-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).