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.


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36587

Johannes Schaub <schaub.johannes at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schaub.johannes@googlemail.
                   |                            |com

--- Comment #7 from Johannes Schaub <schaub.johannes at googlemail dot com> ---
(In reply to Jonathan Wakely from comment #3)
> This would have prevented bugs I've dealt with where critical sections where
> not protected:
> {
>   lock_guard (mutex);
>   // mutex NOT locked here!
> }
> 

Jonathan, unfortunately that code won't create and discard a temporary object,
so I am not sure whether this patch would have caught the mistake of creating a
default constructed lock_guard (whatever that means).


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