[v3 PATCH] Implement LWG 2825, LWG 2756 breaks class template argument deduction for optional.

Ville Voutilainen ville.voutilainen@gmail.com
Mon Jan 30 23:20:00 GMT 2017


On 31 January 2017 at 00:06, Tim Song <t.canens.cpp@gmail.com> wrote:
> 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.


I'll see about constraining the guide tomorrow.



More information about the Gcc-patches mailing list