C++ PATCH for c++/89511 - ICE with using-declarations and unscoped enumerator

Marek Polacek polacek@redhat.com
Wed Feb 27 19:44:00 GMT 2019


On Wed, Feb 27, 2019 at 01:43:12PM -0500, Jason Merrill wrote:
> On Wed, Feb 27, 2019 at 11:49 AM Marek Polacek <polacek@redhat.com> wrote:
> > On Wed, Feb 27, 2019 at 10:53:16AM -0500, Jason Merrill wrote:
> > > On 2/26/19 5:13 PM, Marek Polacek wrote:
> > > > Here we ICE because the unscoped enum's context is a FUNCTION_DECL, which
> > > > push_using_decl can't handle.
> > > >
> > > > http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_active.html#1742
> > > > says this is well-formed (but the scoped enum case is ill-formed).
> > > > Nevertheless, the DR hasn't been resolved either way yet, and trying
> > > > to accept a FUNCTION_DECL as a USING_DECL_SCOPE seems like a lot of
> > > > work, and ultimately maybe both cases will be deemed ill-formed.
> > > >
> > > > This patch fixes the ICE by giving the pre-r211479 error while
> > > > simultaneously keeping using-enum-[12].C working.
> > > >
> > > > Bootstrapped/regtested on x86_64-linux, ok for trunk?
> > > >
> > > > 2019-02-26  Marek Polacek  <polacek@redhat.com>
> > > >
> > > >     PR c++/89511 - ICE with using-declarations and unscoped enumerator.
> > > >     * parser.c (cp_parser_using_declaration): For an unscoped enum
> > > >     only use its context if it's a namespace declaration.
> 
> OK, though you probably want to adjust the ChangeLog entry.

Hold on, are you acking the second version, with TYPE_FUNCTION_SCOPE_P?  That
has a correct ChangeLog entry I believe.

Marek



More information about the Gcc-patches mailing list