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: "schaub.johannes at googlemail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 24 Sep 2013 21:23:01 +0000
- Subject: [Bug c++/36587] Feature: add warning for constructor call with discarded return.
- Auto-submitted: auto-generated
- References: <bug-36587-4 at http dot gcc dot gnu dot org/bugzilla/>
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).