This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ Patch/RFC] PR 80145
- From: "Jason Merrill via gcc-patches" <gcc-patches at gcc dot gnu dot org>
- To: Paolo Carlini <paolo dot carlini at oracle dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 8 May 2017 09:09:26 -0400
- Subject: Re: [C++ Patch/RFC] PR 80145
- Authentication-results: sourceware.org; auth=none
- References: <f0392178-1d4c-b33d-ff95-81b9cb31c290@oracle.com>
- Reply-to: Jason Merrill <jason at redhat dot com>
OK.
On Thu, Mar 23, 2017 at 3:07 PM, Paolo Carlini <paolo.carlini@oracle.com> wrote:
> Hi,
>
> this ICE on invalid code isn't a regression, thus a patch probably doesn't
> qualify for Stage 4, but IMHO I made good progress on it and I'm sending
> what I have now anyway... The ICE happens during error recovery after a
> sensible diagnostic for the first declaration in:
>
> auto* foo() { return 0; }
> auto* foo();
>
> After the error, finish_function does:
>
> apply_deduced_return_type (fndecl, void_type_node);
> fntype = TREE_TYPE (fndecl);
>
> which then is inconsistent with the auto* return type of the second
> declaration and leads to an ICE in merge_types (which duplicate_decls
> thought was safe to call because types_match is true (evidently: decls_match
> uses fndecl_declared_return_type)). Thus, in terms of error recovery, I
> think that in cases like the one at issue it makes sense not to replace
> auto* after the error and leave the return type untouched: certainly the
> below passes testing and avoids ICEing on the testcase at issue and a
> variant of it.
>
> Thanks,
> Paolo.
>
> //////////////////
>