https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104418

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
            Summary|Error inheriting base class |[C++14+] Error inheriting
                   |constructors by             |base class constructors by
                   |using-declaration           |using-declaration
   Last reconfirmed|                            |2022-02-08
           Keywords|                            |rejects-valid

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Fedor Chelnokov from comment #4)
> 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}{}`.

Sorry I meant it should be done by static_cast<int&&>(a) which is the move
syntax rather than by a copy.


There looks like there are some differences between versions of the C++
standard too.
C++11 (before defect reports) In class.inhctor/8 had:
Each expression in the expression-list is of the form static_cast<T&&>(p),
where p is the name
of the corresponding constructor parameter and T is the declared type of p.

But that was removed it looks like with
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0136r1.html 

So the code is invalid C++11 but valid C++14 it seems. clang gets it wrong for
C++11 but gets it correct for C++14+.

GCC gets it wrong for C++14+.

Reply via email to