Issue |
125715
|
Summary |
Error on generic lambda with trailing return type within lambda within template
|
Labels |
new issue
|
Assignees |
|
Reporter |
Eczbek
|
https://godbolt.org/z/E5nrss4df
```cpp
template<class T>constexpr int x=([]{[](auto)->void{}(0);}(),0);
int main(){x<int>;}
```
```
<source>:1:32: error: constexpr variable 'x<int>' must be initialized by a constant _expression_
1 | template<class T>constexpr int x=([]{[](auto)->void{}(0);}(),0);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>:2:12: note: in instantiation of variable template specialization 'x<int>' requested here
2 | int main(){x<int>;}
| ^
<source>:1:38: note: undefined function 'operator()<int>' cannot be used in a constant _expression_
1 | template<class T>constexpr int x=([]{[](auto)->void{}(0);}(),0);
| ^
<source>:1:35: note: in call to '[] {
[](auto) -> void {
}(0);
}.operator()()'
1 | template<class T>constexpr int x=([]{[](auto)->void{}(0);}(),0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
<source>:1:38: note: declared here
1 | template<class T>constexpr int x=([]{[](auto)->void{}(0);}(),0);
| ^
<source>:2:12: warning: _expression_ result unused [-Wunused-value]
2 | int main(){x<int>;}
| ^~~~~~
1 warning and 1 error generated.
Compiler returned: 1
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs