www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20901] New: arrays confuse static foreach

https://issues.dlang.org/show_bug.cgi?id=20901

          Issue ID: 20901
           Summary: arrays confuse static foreach
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: qs.il.paperinik gmail.com

Relevant code: https://run.dlang.io/is/DAkfjA

Depending on whether line 12 (front ~= [ ];) is commented in, one of the
asserts fail. Neither assert should fail.

The code in line 12 does nothing but potentially reallocate an array.

The problem seems not to occur when int[] is replaced by int.

--
Jun 06 2020