phobos icon indicating copy to clipboard operation
phobos copied to clipboard

Infinite loop using join with alias this and non-ascii unicode

Open dlangBugzillaToGithub opened this issue 3 years ago • 2 comments

yazan.dabain reported this on 2021-12-14T17:43:07Z

Transfered from https://issues.dlang.org/show_bug.cgi?id=22599

Description

Running the code below results in an infinite loop.
Removing alias this, the map call or using ascii makes the code run as expected.


```
import std.algorithm: map;
import std.array: join;

struct T
{
	string a;
	alias a this;
}

void main()
{
	auto t = [ T("أ") ]; // has to contain non-ascii unicode (this is the arabic letter أ)
	auto s = t.map!(same => same).join();
}

```

dlangBugzillaToGithub avatar Dec 14 '21 17:12 dlangBugzillaToGithub