This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [v3 PATCH] Implement LWG 2825, LWG 2756 breaks class template argument deduction for optional.
- From: Tim Song <t dot canens dot cpp at gmail dot com>
- To: Jonathan Wakely <jwakely at redhat dot com>, Ville Voutilainen <ville dot voutilainen at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, "libstdc++" <libstdc++ at gcc dot gnu dot org>
- Date: Tue, 31 Jan 2017 06:06:25 +0800
- Subject: Re: [v3 PATCH] Implement LWG 2825, LWG 2756 breaks class template argument deduction for optional.
- Authentication-results: sourceware.org; auth=none
- References: <CAFk2RUa1gqaEgxUpcByBBCorL0Y7K81M+Sbi=q_eUdf1XXu52A@mail.gmail.com> <20170130132821.GR3093@redhat.com> <20170130133614.GS3093@redhat.com>
On Mon, Jan 30, 2017 at 9:36 PM Jonathan Wakely <jwakely@redhat.com> wrote:
>
> On 30/01/17 13:28 +0000, Jonathan Wakely wrote:
> >On 30/01/17 13:47 +0200, Ville Voutilainen wrote:
> >>Tested on Linux-x64.
> >
> >OK, thanks.
>
> To be clear: this isn't approved by LWG yet, but I think we can be a
> bit adventurous with deduction guides and add them for experimental
> C++17 features. Getting more usage experience before we standardise
> these things will be good, and deduction guides are very new and
> untried. If we find problems we can remove them again, and will have
> invaluable feedback for the standards committee.
>
My brain compiler says that this may cause problems with
std::optional<int> o1;
std::optional o2 = o1; // wanted optional<int>, deduced optional<optional<int>>
Trunk GCC deduces optional<int>, but I don't think it implements
P0512R0 yet, which prefers explicit guides to implicit ones before
considering partial ordering. This example is very similar to the
example in https://timsong-cpp.github.io/cppwp/over.match.best#1.6.
Tim