This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] Reject invalid auto foo (), a = 5;


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]