http://d.puremagic.com/issues/show_bug.cgi?id=6344

           Summary: CTFE: Assertion Failure in interpret.c
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: andrej.mitrov...@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrov...@gmail.com> 2011-07-18 
12:07:58 PDT ---
DMD 2.054, XP32:

import std.array;
import std.stdio;
import std.conv;
import std.traits;

enum Foo
{
    pre_x,
    pre_y,
    pre_z,
}  

mixin(wrapEnum!(Foo)("NewEnum", "pre_"));  // fails

private string wrapEnum(Type)(string newName, string prefix)
{
    string result = "enum " ~ newName ~ " {";

    foreach (member; EnumMembers!Type)
    {
        result ~= to!string(member).replace(prefix, "") ~ ",";
    }

    return result ~ "}";
}

void main()
{
    // writeln(wrapEnum!(Foo)("NewEnum", "pre_"));  // writes: enum NewEnum
{x,y,z,}
}

Output:

Assertion failure: 'se->e1->op == TOKarrayliteral || se->e1->op == TOKstring'
on line 4957 in file 'interpret.c'

abnormal program termination

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to