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

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Sep 24 21:49:00 GMT 2013


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

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(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.

(Although your "whatever that means" assumes my example used std::lock_guard,
but if that was the case I'd have needed to use some template arguments.  Other
scoped-lock types are DefaultConstructible, e.g. std::unique_lock<T>)



More information about the Gcc-bugs mailing list