C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Is a default ctor struct C{C(); }; also a converting constructor

From: Sean Mayard <seanmayard_at_[hidden]>
Date: Tue, 9 Jan 2024 23:23:25 +0530
@connor


> You can copy-list-initialize from `{}` if you have a non-explicit default
> constructor. You thus convert from the empty initializer list to C. Thus, I
> would call this a converting constructor.


But that makes the copy ctor a converting ctor and not the default ctor
itself. Note that in your example of copy-list-initialize you're actually
converting an object of that class type to the same class type object.

On Tue, 9 Jan 2024 at 23:14, Giuseppe D'Angelo via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On 09/01/2024 18:33, connor horman via Std-Proposals wrote:
> > You can copy-list-initialize from `{}` if you have a non-explicit
> > default constructor. You thus convert from the empty initializer list to
> > C. Thus, I would call this a converting constructor.
>
> The wording in question has been added by
>
> https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0398r0.html
>
> Cf. the core issue:
>
> https://cplusplus.github.io/CWG/issues/1518.html
>
> Thank you,
> --
> Giuseppe D'Angelo
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2024-01-09 17:53:37