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.
The root of the problem is a check not done during sema I believe, because the following works
---
struct Content{ubyte parts;}
void main(){
enum Content content = {};
content.parts = 2;
}
---
fixing this last example should prevent the ICE as well.
BTW another evidence showing that it's a missing bit in the front end is that LDC2 crashes too (with the reduced test case of comment #2).
Comment #3 by b2.temp — 2019-06-29T18:03:04Z
The previous example is actually a new regression
Comment #4 by dlang-bot — 2019-06-30T14:00:27Z
@Basile-z updated dlang/dmd pull request #10115 "fix issue 20011, fix issue 17828 - crash or accept write operation on members of manifest constant structs" fixing this issue:
- fix issue 20011, 17828 - crash or accept write operation on members of manifest constant structs
https://github.com/dlang/dmd/pull/10115
Comment #5 by dlang-bot — 2019-07-07T08:14:35Z
dlang/dmd pull request #10115 "fix issue 20011, 17828 - crash or accept write operation on members of manifest constant structs" was merged into stable:
- 44469ba0c915f2cc9f017f01a8a738219a130c51 by Basile Burg:
fix issue 20011, 17828 - crash or accept write operation on members of manifest constant structs
https://github.com/dlang/dmd/pull/10115