www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10563] New: Accessing const/immutable string array in CTFE crashes dmd.

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

           Summary: Accessing const/immutable string array in CTFE crashes
                    dmd.
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: iselix1988+dbugzilla gmail.com


--- Comment #0 from iselix1988+dbugzilla gmail.com 2013-07-06 22:13:31 PDT ---
Accessing const/immutable string array in struct/class in CTFE, cause dmd
crashes by segmentation fault.
See code below.

----
immutable string[] array = ["0"];
class cls{
    immutable string[] array = ["0"];
}
struct str{
    immutable string[] array = ["0"];
}

auto top(T)(T t){
    return t[0];
}

pragma(msg, array.top);     // OK
pragma(msg, cls.array.top); // SEGV
pragma(msg, str.array.top); // SEGV

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