https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67519
Bug ID: 67519 Summary: New warning: calls to member functions before all base classes constructed Product: gcc Version: 4.9.4 Status: UNCONFIRMED Keywords: diagnostic Severity: enhancement Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- It's undefined to (directly or indirectly) call a member function in a ctor-initializer before all the mem-initializers for base classes have completed ([class.base.init] p16). It should be possible to warn about this, at least for simple cases. The example in [class.base.init] p16 should give two warnings: class A { public: A(int); }; class B : public A { int j; public: int f(); B() : A(f()), // undefined: calls member function // but base A not yet initialized j(f()) { } // well-defined: bases are all initialized }; class C { public: C(int); }; class D : public B, C { int i; public: D() : C(f()), // undefined: calls member function // but base C not yet initialized i(f()) { } // well-defined: bases are all initialized };