Bug 18581 – Segmentation fault with dmd -X if static foreach inside template
Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-03-08T20:37:33Z
Last change time
2019-02-27T03:39:27Z
Keywords
ice
Assigned to
No Owner
Creator
Ali Ak
Comments
Comment #0 by ali.akhtarzada — 2018-03-08T20:37:33Z
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
Comment #1 by porton — 2019-02-27T03:39:27Z
It seems to be fixed:
$ dmd -o- -X main.d
Error: module `main` is in file 'main.d' which cannot be read
import path[0] = /snap/dmd/49/bin/../import/druntime
import path[1] = /snap/dmd/49/bin/../import/phobos
t,1$ dmd --version
DMD64 D Compiler v2.084.1
Copyright (C) 1999-2018 by The D Language Foundation, All Rights Reserved written by Walter Bright