This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]