This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] Implement P1073R3: Immediate functions (PR c++/88335, take 3)


On Fri, Nov 01, 2019 at 04:42:45PM -0400, Jason Merrill wrote:
> It isn't accepted for me:
> 
> wa3.C: In function 'void foo()':
> wa3.C:4:29: warning: attribute ignored [-Wattributes]
>     4 |   auto a = [] () [[noreturn]] constexpr {};
>       |                             ^
> wa3.C:4:29: note: an attribute that appertains to a type-specifier is
> ignored
> wa3.C: In lambda function:
> wa3.C:4:31: error: expected '{' before 'constexpr'
>     4 |   auto a = [] () [[noreturn]] constexpr {};
>       |                               ^~~~~~~~~
> wa3.C: In function 'void foo()':
> wa3.C:4:31: error: expected ',' or ';' before 'constexpr'
> wa3.C: In lambda function:
> wa3.C:5:44: error: expected '{' before 'constexpr'
>     5 |   auto b = [] () __attribute__((noreturn)) constexpr {};
>       |                                            ^~~~~~~~~
> wa3.C: In function 'void foo()':
> wa3.C:5:44: error: expected ',' or ';' before 'constexpr'
> 
> Moving constexpr before the attributes makes it compile.

Ah, used 8.x to test it.  There have been r265787 and r269775 changes in
between.
Though
  auto d = [] () mutable __attribute__((noreturn)) constexpr {};
  auto e = [] () mutable [[noreturn]] constexpr {};
is still accepted.  I bet incorrectly though, I can try to fix it in a
follow-up patch, but can remove the attribute skipping from the consteval
patch then.

> > The code should handle mutable consteval, as mutable is a keyword and it
> > will just keep looking after that keyword.
> 
> Ah, right.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]