This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Should std::byte copy-list-initialization fail?
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Jeffrey Walton <noloader at gmail dot com>
- Cc: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Mon, 17 Jul 2017 12:42:20 +0100
- Subject: Re: Should std::byte copy-list-initialization fail?
- Authentication-results: sourceware.org; auth=none
- References: <CAH8yC8k6WquriwvvWBp1DuOeqeRO=gRrGb_rSY_124LZuZDTAA@mail.gmail.com> <CAH6eHdTwd5Da_0MFR-b06H+E5p-5=eVEgwDDO25Myb+C-j-uMw@mail.gmail.com> <CAH8yC8k1Oq-n5Od4XneSScPugFYeTBVKzTpOePwmFY8mNrdNwg@mail.gmail.com>
On 17 July 2017 at 09:15, Jeffrey Walton wrote:
> The comments explain my confusion. It seemed like both should succeed,
> or both should fail.
No, because there's no implicit conversion. This is consistent with
'explicit' constructors:
struct S {
explicit S(int) { }
};
S s = { 0 }; // error
S s{ 0 }; // ok
> It looks like special accommodations were made
> for list-initialization under C++17.
Yes, see http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0138r2.pdf