Re: [PATCH] c++: Fix tentative parsing of enum-specifier [PR96077]

2020-07-13 Thread Marek Polacek via Gcc-patches
On Mon, Jul 13, 2020 at 12:18:03PM -0400, Nathan Sidwell wrote: > On 7/13/20 11:15 AM, Marek Polacek wrote: > > On Mon, Jul 13, 2020 at 10:08:52AM -0400, Nathan Sidwell wrote: > > > On 7/10/20 11:43 AM, Marek Polacek via Gcc-patches wrote: > > > > Here's an interesting issue: in this code a ) is mi

Re: [PATCH] c++: Fix tentative parsing of enum-specifier [PR96077]

2020-07-13 Thread Nathan Sidwell
On 7/13/20 11:15 AM, Marek Polacek wrote: On Mon, Jul 13, 2020 at 10:08:52AM -0400, Nathan Sidwell wrote: On 7/10/20 11:43 AM, Marek Polacek via Gcc-patches wrote: Here's an interesting issue: in this code a ) is missing: enum { E = (2 } e; but we compile the code anyway, and E is set to

Re: [PATCH] c++: Fix tentative parsing of enum-specifier [PR96077]

2020-07-13 Thread Marek Polacek via Gcc-patches
On Mon, Jul 13, 2020 at 10:08:52AM -0400, Nathan Sidwell wrote: > On 7/10/20 11:43 AM, Marek Polacek via Gcc-patches wrote: > > Here's an interesting issue: in this code a ) is missing: > > > >enum { E = (2 } e; > > > > but we compile the code anyway, and E is set to 0 in build_enumerator, >

Re: [PATCH] c++: Fix tentative parsing of enum-specifier [PR96077]

2020-07-13 Thread Nathan Sidwell
On 7/10/20 11:43 AM, Marek Polacek via Gcc-patches wrote: Here's an interesting issue: in this code a ) is missing: enum { E = (2 } e; but we compile the code anyway, and E is set to 0 in build_enumerator, which is sneaky. The problem is that cp_parser_enum_specifier parses tentatively, bec

Re: [PATCH] c++: Fix tentative parsing of enum-specifier [PR96077]

2020-07-10 Thread Marek Polacek via Gcc-patches
On Fri, Jul 10, 2020 at 05:53:21PM +0200, Jakub Jelinek wrote: > On Fri, Jul 10, 2020 at 11:43:59AM -0400, Marek Polacek via Gcc-patches wrote: > > diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c > > index 528b41b7170..ee6a956aea9 100644 > > --- a/gcc/cp/parser.c > > +++ b/gcc/cp/parser.c > > @@ -19

Re: [PATCH] c++: Fix tentative parsing of enum-specifier [PR96077]

2020-07-10 Thread Jakub Jelinek via Gcc-patches
On Fri, Jul 10, 2020 at 11:43:59AM -0400, Marek Polacek via Gcc-patches wrote: > diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c > index 528b41b7170..ee6a956aea9 100644 > --- a/gcc/cp/parser.c > +++ b/gcc/cp/parser.c > @@ -19412,7 +19412,12 @@ cp_parser_enum_specifier (cp_parser* parser) >