[Issue 14996] New: only(EnumMembers!T) eats all my memory when T : string
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Sep 1 06:12:13 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14996
Issue ID: 14996
Summary: only(EnumMembers!T) eats all my memory when T : string
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: ryan at rcorre.net
Created attachment 1546
--> https://issues.dlang.org/attachment.cgi?id=1546&action=edit
compiling with dmd should consume excessive memory
I am trying to return a range of all members in a named enum using
only(EnumMembers!MyEnum).
This works fine, unless MyEnum uses string as a backing value and has more than
one element, in which case it eats all 8GB of my memory and crashes DMD.
Test file is attached and pasted below:
---
import std.range : only;
import std.traits : EnumMembers;
enum Bad : string {
confirm = "confirm",
cancel = "cancel" ,
rotateL = "rotateL",
rotateR = "rotateR",
turbo = "turbo" ,
menu = "menu" ,
}
enum Fine {
confirm,
cancel ,
rotatel,
rotater,
turbo ,
menu ,
}
enum AlsoFine : string {
confirm = "confirm",
}
auto allButtons() {
//return only(EnumMembers!Fine); // compiles just fine
//return only(EnumMembers!AlsoFine); // compiles just fine
return only(EnumMembers!Bad); // eats all my memory (8GB)
}
void main() { }
---
--
More information about the Digitalmars-d-bugs
mailing list