[Issue 23391] New: Segmentation fault.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Oct 6 13:06:28 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23391
Issue ID: 23391
Summary: Segmentation fault.
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: james.gray at remss.net
The following code (reduced by Mayonix on discord) causes the compiler to
crash:
```d
struct MyTuple {
string s;
}
inout(string) myfront(inout(string)[] a)
{
return a[0];
}
MyTuple[] myarray(MyZip r)
{
MyTuple[] result;
foreach (e; r)
result ~= e;
return result;
}
struct MyZip
{
bool empty = false;
MyTuple front()
{
return MyTuple([""].myfront);
}
void popFront()
{
empty = true;
}
}
static foreach(t; MyZip().myarray) {}
```
--
More information about the Digitalmars-d-bugs
mailing list