| Issue |
97958
|
| Summary |
lambda's operator() is non-constexpr function
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
Fedr
|
This program
```
static_assert(
[]<int I=0>() -> decltype([]{ return true; })
{ return {}; }()());
```
is accepted in GCC, MSVC and Clang 17, but Clang 18 complains:
```
error: static assertion _expression_ is not an integral constant _expression_
2 | []<int I=0>() -> decltype([]{ return true; })
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 | { return {}; }()());
| ~~~~~~~~~~~~~~~~~~
<source>:2:5: note: non-constexpr function 'operator()' cannot be used in a constant _expression_
<source>:2:31: note: declared here
2 | []<int I=0>() -> decltype([]{ return true; })
```
Online demo: https://gcc.godbolt.org/z/nW74e4q9v
It is a modified example from https://stackoverflow.com/q/77431308/7325599
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs