This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] PR 79091, ICE with unnamed enum mangle
On Tue, Jan 17, 2017 at 3:14 PM, Jason Merrill <jason@redhat.com> wrote:
> On Tue, Jan 17, 2017 at 1:20 PM, Nathan Sidwell <nathan@acm.org> wrote:
>> Jason,
>> in r241944:
>> 2016-11-07 Jason Merrill <jason@redhat.com>
>>
>> Implement P0012R1, Make exception specifications part of the type
>> system.
>>
>> You increment processing_template_decl around the mangling of a template
>> function decl. AFAICT, that's so that nothrow_spec_p doesn't explode at:
>> gcc_assert (processing_template_decl
>> || TREE_PURPOSE (spec) == error_mark_node);
>> when called from the mangler at:
>> if (nothrow_spec_p (spec))
>> write_string ("Do");
>> else if (TREE_PURPOSE (spec))
>> ....
>>
>> the trouble is that's now causing no_linkage_check to bail out early with:
>> if (processing_template_decl)
>> return NULL_TREE;
>>
>> thus triggering the assert:
>> gcc_assert (no_linkage_check (type, /*relaxed_p=*/true));
>> /* Just use the old mangling at namespace scope. */
>>
>> It seems to me risky to have processsing_template_decl incremented, as
>> no_linkage_check is called from a number of places in the mangler.
>
> Makes sense.
>
>> Thus the
>> attached patch, which adds a default arg to nothrow_spec_p to tell it to be
>> a little more lenient.
>>
>> In the old days, I'd've made nothrow_spec_p an asserting wrapper for a
>> non-asserting function, and called that non-asserting function from the
>> mangler. But we can use default arg magic to avoid adjusting all the other
>> call sites. I'm fine with doing it the wrapper way, if you'd prefer.
>>
>> ok?
>
> Hmm, what if write_exception_spec checks for a dependent
> noexcept-specifier first, and noexcept_spec_p second? That seems like
> it would avoid needing any change to nothrow_spec_p.
(OK either way)
Jason