This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH for DR 1518 (c++/54835, c++/60417)
- From: Ville Voutilainen <ville dot voutilainen at gmail dot com>
- To: Jason Merrill <jason at redhat dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 26 Oct 2015 03:04:46 +0200
- Subject: Re: C++ PATCH for DR 1518 (c++/54835, c++/60417)
- Authentication-results: sourceware.org; auth=none
- References: <CAFk2RUZ2FJ5u4x9C0FWPxd0z_my2OyacAP4F=Xs24Sm7vbAdmA at mail dot gmail dot com>
On 25 October 2015 at 22:15, Ville Voutilainen
<ville.voutilainen@gmail.com> wrote:
> It seems to me that there's a discrepancy in handling explicit
> default constructors. Based on my tests, this works:
>
> struct X {explicit X() {}};
>
> void f(X) {}
>
> int main()
> {
> f({});
> }
>
> However, if the explicit constructor is defaulted, gcc accepts the code:
>
> struct X {explicit X() = default;};
>
> void f(X) {}
>
> int main()
> {
> f({});
> }
And to clarify, I'd expect both of those snippets to be rejected, but only the
former is.