www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17828] New: [ICE] Internal error: ddmd/backend/cgcs.c 352 -

https://issues.dlang.org/show_bug.cgi?id=17828

          Issue ID: 17828
           Summary: [ICE] Internal error: ddmd/backend/cgcs.c 352 - CTFE
                    appending to an array on a struct from a template
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: davidbennett bravevision.com

I'm getting the following internal error:

& el:0x28d9280 cnt=0 cs=0 &  TY* 0x28d70e0
 el:0x28d70e0 cnt=0 cs=0 const  TYucent 0LL+0LL 
Internal error: ddmd/backend/cgcs.c 352

For this code:

struct Content{
    string[] parts;
}

void add_part_to_content(Content content, string s)(){
    content.parts ~= "Part: "~s;
}

void main(){
    enum Content content = {};
    add_part_to_content!(content, "Header")();
}

I'm new to D templates / CTFE so not sure if the code is valid.

In ether case it probably shouldn't give an Internal error.

--
Sep 15 2017