This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] Reject invalid auto foo (), a = 5;
- From: Jason Merrill <jason at redhat dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 4 Jan 2017 14:48:20 -0500
- Subject: Re: [C++ PATCH] Reject invalid auto foo (), a = 5;
- Authentication-results: sourceware.org; auth=none
- References: <20170103223930.GA21933@tucnak>
On Tue, Jan 3, 2017 at 5:39 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> + if (auto_function_declaration
> + && (TREE_CODE (decl) == FUNCTION_DECL
> + || auto_function_declaration != error_mark_node))
> + {
> + error_at (decl_specifiers.locations[ds_type_spec],
> + "non-variable %qD in declaration with more than one "
> + "declarator with placeholder type",
> + TREE_CODE (decl) == FUNCTION_DECL
> + ? decl : auto_function_declaration);
> + auto_function_declaration = error_mark_node;
> + }
> + else if (auto_function_declaration == NULL_TREE)
> + auto_function_declaration
> + = TREE_CODE (decl) == FUNCTION_DECL ? decl : error_mark_node;
I might reorder the then/else clauses so you don't need to duplicate
the test whether auto_function_declaration is null, but OK either way.
Jason