This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/36587] Feature: add warning for constructor call with discarded return.
- From: "redi at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Dec 2009 00:37:23 -0000
- Subject: [Bug c++/36587] Feature: add warning for constructor call with discarded return.
- References: <bug-36587-15518@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from redi at gcc dot gnu dot org 2009-12-11 00:37 -------
This would have prevented bugs I've dealt with where critical sections where
not protected:
{
lock_guard (mutex);
// mutex NOT locked here!
}
But I'm not convinced that doing this is always a mistake. Would the warning be
suppressed by casting to void?
(void) TypeWithSideEffectsInCtor(x);
--
redi at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |redi at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36587