Re: C++ PATCH for C++17 selection statements with initializer

2016-11-15 Thread Marek Polacek
On Sat, Nov 05, 2016 at 10:03:37PM -0400, David Edelsohn wrote: > The patch adds testcase init-statement6.C, which includes the declaration > > extern void publish (int), raise (int); > > POSIX defines > > int raise (int); > > in which gets included by the C++ headers for the testcase on AIX.

Re: C++ PATCH for C++17 selection statements with initializer

2016-11-05 Thread David Edelsohn
The patch adds testcase init-statement6.C, which includes the declaration extern void publish (int), raise (int); POSIX defines int raise (int); in which gets included by the C++ headers for the testcase on AIX. This is causes the error message: /nasfarm/edelsohn/src/src/gcc/testsuite/g++.dg

Re: C++ PATCH for C++17 selection statements with initializer

2016-10-05 Thread Jason Merrill
OK.

Re: C++ PATCH for C++17 selection statements with initializer

2016-10-05 Thread Marek Polacek
On Wed, Oct 05, 2016 at 12:11:40PM -0400, Jason Merrill wrote: > On Wed, Oct 5, 2016 at 11:29 AM, Marek Polacek wrote: > > How about the version I just posted, i.e. > > ? > > That doesn't address my first comment. The following uses cp_pa

Re: C++ PATCH for C++17 selection statements with initializer

2016-10-05 Thread Jason Merrill
On Wed, Oct 5, 2016 at 11:29 AM, Marek Polacek wrote: > On Wed, Oct 05, 2016 at 10:48:19AM -0400, Jason Merrill wrote: >> On Wed, Oct 5, 2016 at 9:14 AM, Marek Polacek wrote: >> > +/* Return true if we're looking at (init; cond), false otherwise. */ >> > + >> > +static bool >> > +cp_parser_init_

Re: C++ PATCH for C++17 selection statements with initializer

2016-10-05 Thread Marek Polacek
On Wed, Oct 05, 2016 at 10:48:19AM -0400, Jason Merrill wrote: > On Wed, Oct 5, 2016 at 9:14 AM, Marek Polacek wrote: > > +/* Return true if we're looking at (init; cond), false otherwise. */ > > + > > +static bool > > +cp_parser_init_statement_p (cp_parser *parser) > > +{ > > + unsigned paren_d

Re: C++ PATCH for C++17 selection statements with initializer

2016-10-05 Thread Marek Polacek
On Wed, Oct 05, 2016 at 03:31:51PM +0200, Jakub Jelinek wrote: > On Wed, Oct 05, 2016 at 03:14:25PM +0200, Marek Polacek wrote: > > This is my attempt to implement P0305R1, Selection statements with > > initializer. > > It allows the users to write > > > > if (init; cond) // ... > > > > which

Re: C++ PATCH for C++17 selection statements with initializer

2016-10-05 Thread Jason Merrill
On Wed, Oct 5, 2016 at 9:14 AM, Marek Polacek wrote: > +/* Return true if we're looking at (init; cond), false otherwise. */ > + > +static bool > +cp_parser_init_statement_p (cp_parser *parser) > +{ > + unsigned paren_depth = 0; > + unsigned brace_depth = 0; Do we really need another one of th

Re: C++ PATCH for C++17 selection statements with initializer

2016-10-05 Thread Jakub Jelinek
On Wed, Oct 05, 2016 at 03:14:25PM +0200, Marek Polacek wrote: > This is my attempt to implement P0305R1, Selection statements with > initializer. > It allows the users to write > > if (init; cond) // ... > > which is equivalent to > > { > init > if (cond) // ... > } Well, it isn

C++ PATCH for C++17 selection statements with initializer

2016-10-05 Thread Marek Polacek
This is my attempt to implement P0305R1, Selection statements with initializer. It allows the users to write if (init; cond) // ... which is equivalent to { init if (cond) // ... } Similarly for if-else, if constexpr, and switch. The approach I had taken was to tentatively parse