www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22599] New: Infinite loop using join with alias this


          Issue ID: 22599
           Summary: Infinite loop using join with alias this
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: yazan.dabain gmail.com

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

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();


Dec 14 2021