diff --git a/gcc/cp/call.c b/gcc/cp/call.c index b6e9f125aeb..a2c5ef736a2 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -8470,7 +8470,7 @@ make_base_init_ok (tree exp) return true; gcc_assert (DECL_COMPLETE_CONSTRUCTOR_P (fn)); fn = base_ctor_for (fn); - if (!fn || DECL_HAS_IN_CHARGE_PARM_P (fn)) + if (!fn || DECL_HAS_VTT_PARM_P (fn)) /* The base constructor has more parameters, so we can't just change the call target. It would be possible to splice in the appropriate arguments, but probably not worth the complexity. */ diff --git a/gcc/testsuite/g++.dg/init/elide7.C b/gcc/testsuite/g++.dg/init/elide7.C new file mode 100644 index 00000000000..d4bacaf7800 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/elide7.C @@ -0,0 +1,9 @@ +// PR c++/98744 +// { dg-additional-options "-O2 -fno-inline -Wmaybe-uninitialized" } + +struct A {}; +struct B : virtual A {}; +struct C : B { + C() : B(B()) {} +}; +int main() { C c; return 0; }