[Patch] [add changelog] reduce template instantiation depth in <variant>
Jonathan Wakely
jwakely@redhat.com
Tue Nov 15 12:17:00 GMT 2016
On 12/11/16 14:48 -0600, Barrett Adair wrote:
>On Sat, Nov 12, 2016 at 2:39 PM, Tim Shen <timshen@google.com> wrote:
>> On Sat, Nov 12, 2016 at 4:28 AM, Daniel Krügler
>> <daniel.kruegler@gmail.com> wrote:
>>> 2016-11-12 10:04 GMT+01:00 Barrett Adair <barrettellisadair@gmail.com>:
>>>>>Currently, std::variant exceeds the default ftemplate-depth parameter when instantiated with 297 types. This small patch increases this ceiling to 446 types (from the bottom of the template stack).
>>>>
>>>> Sorry, first patch - I just read the guidelines. I changed the format
>>>> and added a changelog entry. I hope I did it correctly this time.
>>>
>>> Let me add that this patch suggestion causes a change in semantics in
>>> theory, because fold expressions have no short-circuit evaluation,
>>
>> Is it a compiler QoI problem, or part of the language? I'd be
>> surprised if the language somehow prohibits the short circuits from
>> happening.
>>
>>> contrary to __and_. Whether this difference is relevant here is
>>> of-course something the maintainer has to decide.
>>>
>
>Since there are no side-effects, and the metafunctions in play cannot
>SFINAE, I don't believe the semantics are actually affected by
>short-circuiting in this case.
I think the only semantic difference would be if one of the types is
an invalid argument to a trait like is_move_constructible, which would
only be possible for an incomplete type, which can't be used with
variant anyway. So I agree the short-circuiting doesn't change
semantics in this case.
An entirely different matter is whether you have a GCC copyright
assignment in place, and if not whether you'd be willing to complete
one. Without that, or a statement to place your changes in the public
domain, we can't accept the patch anyway and the technical merits are
secondary. You can contact me off-list for further details if needed.
More information about the Libstdc++
mailing list