Re: [PATCH] c++: wrong parse with functors [PR64679]

2022-05-04 Thread Marek Polacek via Gcc-patches
On Tue, May 03, 2022 at 04:43:05PM -0400, Jason Merrill via Gcc-patches wrote: > On 5/2/22 12:18, Marek Polacek wrote: > > Consider > > > >struct F { > > F(int) {} > > F operator()(int) const { return *this; } > >}; > > > > and > > > >F(i)(0)(0); > > > > where we're

Re: [PATCH] c++: wrong parse with functors [PR64679]

2022-05-03 Thread Jason Merrill via Gcc-patches
On 5/2/22 12:18, Marek Polacek wrote: Consider struct F { F(int) {} F operator()(int) const { return *this; } }; and F(i)(0)(0); where we're supposed to first call the constructor and then invoke the operator() twice. However, we parse this as an init-declarator: "(i)"

[PATCH] c++: wrong parse with functors [PR64679]

2022-05-02 Thread Marek Polacek via Gcc-patches
Consider struct F { F(int) {} F operator()(int) const { return *this; } }; and F(i)(0)(0); where we're supposed to first call the constructor and then invoke the operator() twice. However, we parse this as an init-declarator: "(i)" looks like a perfectly valid declarator, then