www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6344] New: CTFE: Assertion Failure in interpret.c

reply d-bugmail puremagic.com writes:
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: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



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: -------
Jul 18 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6344


kennytm gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kennytm gmail.com



First reduction:

--------------------------------
import std.array;

string rp(string subject) {
    auto app = appender!string();
    app.put(subject[0 .. 0]); 
    auto m = app.data;
    return m;
}

enum e = rp("pre_x");
--------------------------------

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 18 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6344


kennytm gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
            Summary|CTFE: Assertion Failure in  |[CTFE] Assertion Failure in
                   |interpret.c                 |interpret.c when create an
                   |                            |empty slice from null
                   |                            |pointer



Ultimate cause: create an empty slice from a 'null' pointer.

----------------------
static assert({
    char* c = null;
    auto m = c[0..0];
    return true;
}());
----------------------

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 18 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6344


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED



20:33:57 PDT ---
https://github.com/D-Programming-Language/dmd/commit/3309fcddfbc4e445a3e418c31a49d157c33161aa

https://github.com/D-Programming-Language/dmd/commit/2ea02077de9498746f5abb0043dc6ae1e5accefc

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