[Bug c++/104418] Error inheriting base class constructors by using-declaration

2022-02-07 Thread fchelnokov at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104418 --- Comment #4 from Fedor Chelnokov --- I think `using B::B;` is not the same as redefining each constructor with the explicit call of base class constructor `C(int a) : B{(int)a}{}`. Please consider this example proving it: ``` struct A {

[Bug c++/104418] Error inheriting base class constructors by using-declaration

2022-02-07 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104418 --- Comment #3 from Andrew Pinski --- But this is invalid code with a similar error message: struct B { B(int) {} B(int&&) {} }; struct C : B { C(int a) : B{(int)a}{} }; So the question is how is default constructor done, is it done

[Bug c++/104418] Error inheriting base class constructors by using-declaration

2022-02-07 Thread fchelnokov at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104418 --- Comment #2 from Fedor Chelnokov --- My personal feeling is that if a compiler accepts `B b(i);` then it must accept `C c(i);` as well because of [namespace.udecl] p13: > Constructors that are named by a using-declaration are treated as thou

[Bug c++/104418] Error inheriting base class constructors by using-declaration

2022-02-07 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104418 --- Comment #1 from Andrew Pinski --- MSVC and ICC reject this for the same reason as GCC. Are you sure this is not a bug in clang?