https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84349

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.8.4
      Known to fail|                            |4.9.4, 5.5.0, 6.4.0, 7.2.0,
                   |                            |8.0

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
A slightly simpler test case:

  void *p = (int(*)(auto))0;

The bug seems to be that the auto isn't rejected in this context (namespace
scope).  The same initializer is rejected in local scope.

Accepting it in an initializer expression results in incrementing the
processing_template_decl counter in the test case from its initial value of
zero to 1.  The counter doesn't get decremented back to zero which then
triggers the unpaired call to finish_lambda_scope() below:

          if (!member_p && processing_template_decl)
            start_lambda_scope (decl);
          initializer = cp_parser_initializer (parser,
                                               &is_direct_init,
                                               &is_non_constant_init);
          if (!member_p && processing_template_decl)
            finish_lambda_scope ();

AFAICS, the problem is somewhere in cp_parser_decl_specifier_seq() that creates
a decl_specifiers.type for the initializer at global scope for which
type_uses_auto() returns null.

Reply via email to