c++/8211: -Weffc++ warns about copyable classes with func ptr members

olly@survex.com olly@survex.com
Sun Oct 13 08:56:00 GMT 2002


>Number:         8211
>Category:       c++
>Synopsis:       -Weffc++ warns about copyable classes with func ptr members
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 13 08:56:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Olly Betts
>Release:        g++-3.2 (GCC) 3.2.1 20020924 (Debian prerelease)
>Organization:
>Environment:
Linux 2.4.19-686
>Description:
-Weffc++ warns about classes which use the default copy ctor
and assignment operator and contain pointer members.  But the
warning also fires for function pointer members - this would
seem to be incorrect - a function pointer cannot be "freed"
so there aren't really any issues of resource ownership and
deallocation (unless dlclose is counted perhaps, but in
general the warning in this case seems more unhelpful than
helpful as there doesn't seem to be an easy way to suppress
it).
>How-To-Repeat:
Compile the attached file with:

g++ -Weffc++ -c effcpp.cc
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="effcpp.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="effcpp.cc"

Y2xhc3MgdGVzdCB7CiAgICB2b2lkICgqZm4pKHZvaWQpOwogICAgdGVzdCh2b2lkICgqZikodm9p
ZCkpIDogZm4oZikge30KfTsK



More information about the Gcc-bugs mailing list