[Bug c++/33475] New warning suggestion: virtual functions called from constructors/destructors
yuri at tsoft dot com
gcc-bugzilla@gcc.gnu.org
Wed Sep 19 23:37:00 GMT 2007
------- Comment #5 from yuri at tsoft dot com 2007-09-19 23:37 -------
I would like to note that this isn't a clear-cut suggestion for the following
reasons:
* It's impossible to enforce such warning in all cases, only in case of virtual
functions immediately called from constructor/destructor.
* People often use virtual functions from destructors to uninitialize things.
And in many cases it's semi-safe. But it's almost always wrong to call virtual
functions from constructors.
* It probably makes sense to add such warning to Valgrind as well to issue it
based on the run-time analysis
But still such warning in gcc can prevent many errors waiting to happen from
happening. gcc must do as much as possible preventing dangerous coding
patterns.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33475
More information about the Gcc-bugs
mailing list