https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123083
Bug ID: 123083
Summary: [13/14/15 regression] ICE on auto operator returning a
range view transform
Product: gcc
Version: 13.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: federicowilliamson at hotmail dot co.uk
Target Milestone: ---
The following code causes an "g++: internal compiler error: Segmentation fault
signal terminated program cc1plus".
Compilation flags: `--std=c++20`
Godbolt link: https://godbolt.org/z/Wjcnnxoq7
```cpp
#include <ranges>
#include <vector>
struct Foo {
operator auto() {
return std::vector<int>{} | std::ranges::views::transform([](auto entry) {
return entry;
});
}
};
```
Some observations:
GCC < 12 does not know abour operator|, so not applicable.
GCC <= 12.5 seems to compile with no error.
GCC >= 13.1 seems to seg fault. (c++ std > 20)
Tested via Godbolt up to GCC 15.2
Interestingly std::identity() works fine: https://godbolt.org/z/qczqnKdc6.
Maybe related: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121797