[C++ Patch] PR 85028 ("[8 Regression] ICE on invalid C++ code: in tsubst_default_argument, at cp/pt.c:12340")

Jason Merrill jason@redhat.com
Wed Mar 28 14:29:00 GMT 2018


OK.

On Wed, Mar 28, 2018 at 8:25 AM, Paolo Carlini <paolo.carlini@oracle.com> wrote:
> Hi,
>
> as I said in the audit trail, in its way this error recovery issue is
> somewhat interesting: Jason's r251422 added some code at the beginning of
> tsubst_default_argument, included the gcc_assert that triggers here. In
> fact, parmtype is only used in the assertion thus the error recovery check
> could be moved inside the assertion, something like (appears to also pass
> testing, lightly tested, so far):
>
> gcc_assert (parmtype == error_mark_node ||
> same_type_ignoring_top_level_qualifiers_p (type, parmtype));
>
> and for this bug we would be back to the gcc-7 status, thus we would not ICE
> and we would issue *2* errors, one for the parameter and then one more for
> the default argument itself, at instantiation time. In fact, some other
> compilers also do that. Or, as I have below, we can return early, after the
> first error. Tested x86_64-linux.
>
> Thanks, Paolo.
>
> ///////////////////
>



More information about the Gcc-patches mailing list