This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] Implement P1073R3: Immediate functions (PR c++/88335, take 3)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 1 Nov 2019 21:56:44 +0100
- Subject: Re: [C++ PATCH] Implement P1073R3: Immediate functions (PR c++/88335, take 3)
- References: <f1871c92-b72b-d3b0-ddde-4c13d1f52464@redhat.com> <CADzB+2=H_CerQ-Nh+3128MZy899hhhZn4e74tfGXOxBQUmyp5w@mail.gmail.com> <20191022144100.GC2116@tucnak> <CADzB+2mf1EVErU21PO1M4xj1N2OPRDm=ae9+5VuDNGjHGrG4FQ@mail.gmail.com> <20191024114723.GM2116@tucnak> <a824057f-3aff-cad4-8bf1-000ebcad9f4e@redhat.com> <20191031172150.GO4650@tucnak> <4fb6bd3f-b4b3-4ed4-061d-1b001c1e2452@redhat.com> <20191101195715.GS4650@tucnak> <61fedee6-6e86-dcf3-7c14-39beea5c2ecb@redhat.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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