Issue |
144540
|
Summary |
ICE on a lambda that uses deducing this and parameter pack capture
|
Labels |
new issue
|
Assignees |
|
Reporter |
sigasigasiga
|
```cpp
template<int I>
struct constant {};
template<typename ...Args>
auto fast_tuple(Args... args)
{
return
[...args = args]
<typename Self, int I>
(this Self &&self, constant<I>)
-> decltype(args...[I])
{
return args...[I];
};
}
int main()
{
auto r = fast_tuple(1, 2.0);
auto &&ll = r(constant<0>{});
}
```
https://godbolt.org/z/rhzWfns3K
I tried to reduce this code snippet even more but I haven't managed to do that:
* If you change the return type of the lambda (`-> decltype(args...[I])`), it stops crashing
* If you remove deducing this (`this Self &&`), it stops crashing
* If you remove `constant<I>` and start using non-deduced index, it stops crashing
Somehow the synergy of these three features produces surprising crash-causing combo.
Funnily enough it also crashes the latest version of gcc
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs