Internal error mixing templates and CTFE
David Bennett via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Sep 15 05:58:47 UTC 2017
Hi Guys,
I've been playing around with CTFE today to see how far I would
push it but I'm having an issue appending to an array on a struct
in CTFE from a template:
```
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")();
}
```
This generates the following output:
& el:0x24052a0 cnt=0 cs=0 & TY* 0x2403100
el:0x2403100 cnt=0 cs=0 const TYucent 0LL+0LL
Internal error: ddmd/backend/cgcs.c 352
FYI: I also get the same error with the template
add_part_to_content(alias Content content, alias s) syntax.
So two questions:
Should what I'm doing be possible?
Is this an error in dmd, and should I open a bug report?
More information about the Digitalmars-d-learn
mailing list