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.
Comment #1 by timon.gehr — 2018-05-02T21:22:57Z
Comment #2 by timon.gehr — 2018-05-02T21:24:40Z
*** Issue 18787 has been marked as a duplicate of this issue. ***
Comment #3 by r.sagitario — 2018-05-31T14:40:22Z
*** Issue 18895 has been marked as a duplicate of this issue. ***
Comment #4 by github-bugzilla — 2018-06-03T18:29:56Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/7736eb59fe766d3c59720f070bf86cfe4bf7f584 fix Issue 18211 - Access violation when generating JSON on static foreach https://github.com/dlang/dmd/commit/1108825f71587d036f1c26ece61b0b44968b9f88 Merge pull request #8214 from tgehr/fix18211 fix Issue 18211 - Access violation when generating JSON on static foreach