| Issue |
114234
|
| Summary |
Clang: immediately-invoked lambda in template arg is not implicitly constexpr
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
elbeno
|
An IILE as a template argument inside some other templates; this is the smallest SSCCE I could find.
```cpp
template <auto Arg>
auto g() { return Arg; }
template <typename>
auto f() {
[]<typename>() {
// lambda is not treated as implicitly constexpr?
g<[] { return 123; }()>();
// explicit constexpr works
// g<[] () constexpr { return 123; }()>();
}.template operator()<int>();
}
int main() { f<int>(); }
```
produces:
```console
<source>:8:9: error: no matching function for call to 'g'
8 | g<[] { return 123; }()>();
| ^~~~~~~~~~~~~~~~~~~~~~~
<source>:6:20: note: while substituting into a lambda _expression_ here
6 | []<typename>() {
| ^
<source>:14:14: note: in instantiation of function template specialization 'f<int>' requested here
14 | int main() { f<int>(); }
| ^
<source>:2:6: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'Arg'
2 | auto g() { return Arg; }
| ^
1 error generated.
```
https://godbolt.org/z/x6heGf38x
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs