www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18581] New: Segmentation fault with dmd -X if static foreach

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

          Issue ID: 18581
           Summary: Segmentation fault with dmd -X if static foreach
                    inside template
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ali.akhtarzada gmail.com

The following seg faults:

template A(T) {
  static foreach(I; 0 .. 1) { }
  alias A = T;
}

void main() {
  A!int a;
}

$ dmd -o- -X main.d

Comment out the static foreach and it won't segfault anymore.

Tried with dmd v2.079.0-beta.1 and dmd v2.078.3 locally, and on run.dlang.io
you get:

Since      2.076.1: Segfault and no output

https://run.dlang.io/is/SliEb2

--
Mar 08 2018