[Bug c++/115844] [14 Regression] Invalid diagnostics for correctly-rejected non-consteval call in consteval function called in a regular lambda
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jul 9 17:15:41 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115844
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=107687
Resolution|--- |INVALID
Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
clang gives the same error message:
```
<source>:16:5: error: call to immediate function 'main()::(anonymous
class)::operator()' is not a constant expression
16 | l();
| ^
<source>:12:9: note: read of non-constexpr variable 'l' is not allowed in a
constant expression
12 | x += 1;
| ^
<source>:16:5: note: in call to 'l.operator()()'
16 | l();
| ^~~
<source>:11:10: note: declared here
11 | auto l = [&x] {
| ^
```
See https://wg21.link/p2564 (PR 107687) and
https://gcc.gnu.org/onlinedocs/gcc-14.1.0/gcc/C_002b_002b-Dialect-Options.html#index-fno-immediate-escalation
.
More information about the Gcc-bugs
mailing list