https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102251
Bug ID: 102251 Summary: Valid code is rejected in ternary operator with unique conversion Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: fchelnokov at gmail dot com Target Milestone: --- Ternary operator ?: here must convert A into B using B::B(const A &) ``` #include <type_traits> class A; struct B { B() {} B(const A &) {} }; class A : B {}; static_assert(std::is_convertible_v<A, B>); int main() { void( true ? B{} : A{} ); } ``` but GCC prints the error "'B' is an inaccessible base of 'A'" Other compilers accept the code: https://gcc.godbolt.org/z/oxefo4h5n