public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61229] warn_unused_result fails to work with member functions
       [not found] <bug-61229-4@http.gcc.gnu.org/bugzilla/>
@ 2014-05-19 12:15 ` redi at gcc dot gnu.org
  2014-05-19 12:35 ` plasmahh at gmx dot net
  2015-02-02 14:33 ` thomas.huxhorn at web dot de
  2 siblings, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2014-05-19 12:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61229

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
You get a warning if you call B::foo or if it's not inline.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/61229] warn_unused_result fails to work with member functions
       [not found] <bug-61229-4@http.gcc.gnu.org/bugzilla/>
  2014-05-19 12:15 ` [Bug c++/61229] warn_unused_result fails to work with member functions redi at gcc dot gnu.org
@ 2014-05-19 12:35 ` plasmahh at gmx dot net
  2015-02-02 14:33 ` thomas.huxhorn at web dot de
  2 siblings, 0 replies; 3+ messages in thread
From: plasmahh at gmx dot net @ 2014-05-19 12:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61229

Dennis Lubert <plasmahh at gmx dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |---

--- Comment #2 from Dennis Lubert <plasmahh at gmx dot net> ---
Since someone else pointed out that there is a bug talking about duplicates
already, now how my real code is more like the following. Also note that it
warns when I remove the dtor of evr.

struct evr
{
        ~evr( );
};

struct evd
{
        virtual __attribute__((warn_unused_result)) evr rs( ) = 0;
};


class sd
{
        [[gnu::warn_unused_result]] evr callme( evd& );
};


evr sd::callme( evd& edis )
{
        edis.rs();
}


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/61229] warn_unused_result fails to work with member functions
       [not found] <bug-61229-4@http.gcc.gnu.org/bugzilla/>
  2014-05-19 12:15 ` [Bug c++/61229] warn_unused_result fails to work with member functions redi at gcc dot gnu.org
  2014-05-19 12:35 ` plasmahh at gmx dot net
@ 2015-02-02 14:33 ` thomas.huxhorn at web dot de
  2 siblings, 0 replies; 3+ messages in thread
From: thomas.huxhorn at web dot de @ 2015-02-02 14:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61229

Thomas Huxhorn <thomas.huxhorn at web dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thomas.huxhorn at web dot de

--- Comment #3 from Thomas Huxhorn <thomas.huxhorn at web dot de> ---
Here is another one:

class C {
public:
   ~C() {} // comment out to trigger warning at c.noWarning()

  int giveWarning()  __attribute__((warn_unused_result)) { return 0; }
  C noWarning()  __attribute__((warn_unused_result)) { return C(); }
};

int main() {
    C c;
    c.giveWarning();
    c.noWarning();
   return 0;
}


A workaround for me is to delete the empty deconstrcutor. But thats not always
possible :/


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-02-02 14:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-61229-4@http.gcc.gnu.org/bugzilla/>
2014-05-19 12:15 ` [Bug c++/61229] warn_unused_result fails to work with member functions redi at gcc dot gnu.org
2014-05-19 12:35 ` plasmahh at gmx dot net
2015-02-02 14:33 ` thomas.huxhorn at web dot de

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).