https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118576
Bug ID: 118576 Summary: gcc does not realize implicitly deleted default constructor in virtual inheritance with using-decl Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: accepts-invalid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: rush102333 at gmail dot com Target Milestone: --- Consider the following code: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ struct A { A(int); }; struct B : virtual A { using A::A; }; struct C1 : virtual B { using B::B; }; struct D1 : virtual C1 { using C1::C1; }; D1 d1(0); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Clang rejects this by complaining that the default constructor of 'B' is necessary here, which does not exist: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <source>:14:4: error: constructor inherited by 'D1' from base class 'A' is implicitly deleted 14 | D1 d1(0); | ^ <source>:7:13: note: constructor inherited by 'D1' is implicitly deleted because base class 'B' has a deleted corresponding constructor 7 | struct C1 : virtual B { using B::B; }; | ^ <source>:5:12: note: default constructor of 'B' is implicitly deleted because base class 'A' has no default constructor 5 | struct B : virtual A { using A::A; }; | ^ 1 error generated. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ EDG and ICC error for similar reasons: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "<source>", line 14: error: no default constructor exists for class "A" D1 d1(0); ^ detected during implicit generation of "D1::A(int)" at line 14 1 error detected in the compilation of "<source>". Compiler returned: 2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ But gcc seems not: https://godbolt.org/z/5srhhqWeE