[Bug c++/36587] Feature: add warning for constructor call with discarded return.

redi at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Dec 11 00:37:00 GMT 2009



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



More information about the Gcc-bugs mailing list