[Bug c++/70035] [5/6 Regression] Calling a non-virtual member in base-class constructor call with ubsan causes segfault when superclass has virtual member with same name
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Mar 2 17:25:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70035
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The call to a member function before all base classes are initialized is
undefined behaviour:
12.6.2 [class.base.init] p16
Member functions (including virtual member functions, 10.3) can be called for
an object under construction.[...] However, if these operations are performed
in a ctor-initializer (or in a function called directly or indirectly from a
ctor-initializer) before all the mem-initializers for base classes have
completed, the result of the operation is undefined.
There is a very similar example below that paragraph.
More information about the Gcc-bugs
mailing list