[Bug c++/36587] New: Feature: add warning for constructor call with discarded return.
kkylheku at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Jun 20 19:22:00 GMT 2008
This patch implements a ``-Wunused-objects'' warning which is triggered if a
constructor is called, and the returned object is thrown away.
This can happen by accident when a declaration for an object accidentally omits
a name. For instance:
{
trace_class ("foo", ...);
// ^ missing name
}
Whereas it is common for C++ function calls to discard returned objects,
discarding the result of an explicit constructor call is most likely a mistake.
I developed a patch against GCC 4.1.1 for this (because that's the compiler
currently used by my organization). The patch doesn't include a documentation
update, just code.
--
Summary: Feature: add warning for constructor call with discarded
return.
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kkylheku at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36587
More information about the Gcc-bugs
mailing list