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

2009-12-10 Thread redi 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 war

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

2009-12-10 Thread kkylheku at gmail dot com
--- Comment #4 from kkylheku at gmail dot com 2009-12-11 02:34 --- (In reply to comment #3) > 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 thi

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

2009-12-11 Thread jwakely dot gcc at gmail dot com
--- Comment #5 from jwakely dot gcc at gmail dot com 2009-12-11 10:39 --- (In reply to comment #4) > > But I'm not convinced that doing this is always a mistake. > > Since we don't care about the object, we must care about the constructor side > effect. I seem to be under the impressio

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

2009-12-11 Thread kkylheku at gmail dot com
--- Comment #6 from kkylheku at gmail dot com 2009-12-11 11:57 --- (In reply to comment #5) > (In reply to comment #4) > > > But I'm not convinced that doing this is always a mistake. > > > > Since we don't care about the object, we must care about the constructor > > side > > effect.

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

2008-06-20 Thread kkylheku at gmail dot com
--- Comment #1 from kkylheku at gmail dot com 2008-06-20 19:23 --- Created an attachment (id=15798) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15798&action=view) Implements -Wunused-objects warning for C++. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36587

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

2008-06-20 Thread kkylheku at gmail dot com
--- Comment #2 from kkylheku at gmail dot com 2008-06-20 20:26 --- I should add that this is different from -Wunused-value, because I want this warning emitted even if the constructor (or its corresponding destructor) have side effects. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id

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

2015-07-23 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36587 Manuel López-Ibáñez changed: What|Removed |Added CC||manu at gcc dot gnu.org --- Commen

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

2015-07-24 Thread kkylheku at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36587 --- Comment #11 from Kaz Kylheku --- (In reply to Manuel López-Ibáñez from comment #10) > (In reply to Kaz Kylheku from comment #1) > > Created attachment 15798 [details] > > Implements -Wunused-objects warning for C++. > > Patches need to be pr

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

2015-07-24 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36587 --- Comment #12 from Jonathan Wakely --- (In reply to Kaz Kylheku from comment #11) > The bug database has an "enhancement" type, so obviously, it is to be used > for submitting enhancements. No, it's for submitting enhancement *requests*, i.e.

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

2015-07-24 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36587 --- Comment #13 from Manuel López-Ibáñez --- (In reply to Kaz Kylheku from comment #11) > I deployed that change to large team of developers, and the toolchain with > that change went to customers also. The warning caught problems that were > fix

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

2013-09-24 Thread schaub.johannes at googlemail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36587 Johannes Schaub changed: What|Removed |Added CC||schaub.johannes@googlemail.

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

2013-09-24 Thread redi at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36587 --- Comment #8 from Jonathan Wakely --- (In reply to Johannes Schaub from comment #7) > Jonathan, unfortunately that code won't create and discard a temporary > object, Yes, you're right, there's no temporary so it's not relevant to this PR. (Al

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

2013-09-24 Thread redi at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36587 --- Comment #9 from Jonathan Wakely --- I still think it would be nice to get a warning for e.g. std::unique_lock(m); where "M m" is visible in an enclosing scope and would have been a viable argument for another constructor, but that would b

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

2024-03-16 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36587 Andrew Pinski changed: What|Removed |Added Resolution|--- |FIXED Target Milestone|---

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

2024-03-17 Thread kkylheku at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36587 --- Comment #15 from Kaz Kylheku --- (In reply to Manuel López-Ibáñez from comment #13) > (In reply to Kaz Kylheku from comment #11) > > I deployed that change to large team of developers, and the toolchain with > > that change went to customers

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

2024-03-17 Thread kkylheku at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36587 --- Comment #16 from Kaz Kylheku --- (In reply to Andrew Pinski from comment #14) > C++17 adds nodiscard attribute which can be placed on class/struct types, > functions, constructors and others and then you get a warning if you ignore > the valu

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

2024-03-17 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36587 --- Comment #17 from Jonathan Wakely --- No, the nodiscard warnings must be silenced with a cast to void. They can't be "stronger" than that.

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

2024-03-18 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36587 --- Comment #18 from Jonathan Wakely --- (In reply to Kaz Kylheku from comment #15) > In April 2020 I created a patch for the GNU C Preprocessor, with > documentation, test cases and everything. I submitted it to the GCC Patches > mailing list, e

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

2024-03-18 Thread kkylheku at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36587 --- Comment #19 from Kaz Kylheku --- (In reply to Jonathan Wakely from comment #18) > Was there an earlier submission? No there wasn't; that's my mistake in my comment.