[Issue 19169] [betterC] bogus TypeInfo error for `enum string[] a = ["a"]; auto aa = a;`
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Aug 14 13:27:01 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=19169
Mike Franklin <slavo5150 at yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |slavo5150 at yahoo.com
--- Comment #2 from Mike Franklin <slavo5150 at yahoo.com> ---
The problem is here:
https://github.com/dlang/dmd/blob/48726c875fbfe16fd93051570d149e893d2dc3dc/src/dmd/e2ir.d#L5047-L5050
---
// call _d_arrayliteralTX(ti, dim)
e = el_bin(OPcall, TYnptr,
el_var(getRtlsym(RTLSYM_ARRAYLITERALTX)),
el_param(el_long(TYsize_t, dim), getTypeInfo(ale.loc, ale.type, irs)));
---
The compiler is generating a call to `_d_arrayliteralTX` in druntime:
https://github.com/dlang/druntime/blob/9a8edfb48e4842180c706ee26ebd8edb10be53f4/src/rt/lifetime.d#L2279
That runtime hook requires a `TypeInfo` parameter.
One solution would be to replace `_d_arrayliteralTX` with a template and a
compile-time type parameter, but this issue does beg the question why it is
even calling `_d_arrayliteralTX` in the first place.
--
More information about the Digitalmars-d-bugs
mailing list