Bug 18211 – Access violation when generating JSON on static foreach
Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2018-01-08T16:55:00Z
Last change time
2018-06-03T18:30:14Z
Keywords
ice
Assigned to
No Owner
Creator
Bastiaan Veelo
Comments
Comment #0 by Bastiaan — 2018-01-08T16:55:00Z
Code containing this valid mixin template
```
mixin template withEnum(E) if (is(E == enum))
{
import std.traits;
import std.format;
static foreach (i, member; EnumMembers!E)
mixin(format!"alias %s = %s.%s;\n"(member, __traits(identifier, E), member));
}
```
causes dmd to halt with an access violation when the -X option is given:
dmd -o- -X bug.d
object.Error@(0): Access Violation
----------------
0x00413D42
0x00409997
0x00519116
0x00519EF3
0x0058BF4D
0x771E1BC5 in RtlQueryProcessDebugInformation
0x771E15A2 in RtlCreateQueryDebugBuffer
0x7715D5ED in RtlDllShutdownInProgress
0x77174104 in RtlAllocateHeap
0x7717334D in RtlAllocateHeap
0x69000B62
Otherwise the code compiles and works as intended:
unittest
{
enum Enumer {One, Four = 4, Five, Six, Ten = 10}
mixin withEnum!(Enumer);
static assert(One == Enumer.One);
static assert(Four == Enumer.Four);
}
This is a problem for ddox: it won't generate documentation for my project because of this.