[PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr()
Martin Uecker
muecker at gwdg.de
Sat Dec 7 21:06:04 UTC 2024
Am Samstag, dem 07.12.2024 um 21:00 +0000 schrieb David Laight:
> From: Martin Uecker
> > Sent: 07 December 2024 19:52
...
>
> > There exist proposals along those lines for C2Y.
> >
> > From a more near-term solution, I wonder if making it possible (or
> > easier) to return integer constant expressions from statement
> > expressions and allowing a restricted form of statement expressions
> > at file scope would help?
>
> It would help a lot if a #define that just used local variables
> to avoid arguments being re-expanded and for CSE could still
> generate a constant value.
> Does need to be a #define - to get token pasting and 'stringify'.
> Although you would need something for reporting detected errors,
> and builtin compiler support for const_true() for the detection
> itself.
We are super close:
https://godbolt.org/z/Tarq89bha
(if we ignore the grotesque hacks to get there, but this would go
away if the compiler does it internally)
Martin
More information about the Intel-gfx
mailing list