[Issue 15711] Incorrect type inferring of [char]/string when passed via recursive template, extracting it from a structure field
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Feb 25 09:04:00 PST 2016
https://issues.dlang.org/show_bug.cgi?id=15711
ag0aep6g at gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Status|RESOLVED |REOPENED
CC| |ag0aep6g at gmail.com
Resolution|INVALID |---
--- Comment #3 from ag0aep6g at gmail.com ---
(In reply to Alexander Tumin from comment #2)
> According to cast table from https://dlang.org/spec/const3.html this is not
> bug at all and should be the defined behavior; const(char)[], what ['z'] is,
> cannot be implicitly converted to immutable(char)[], which what the string
> is.
`['z']` is an array literal, though. They're more flexible than that.
For example, dmd accepts these:
----
immutable(int)[] a = [1, 2, 3];
string s = ['z'];
Quu q = Quu(['z']);
----
I see no reason why the code in the description should be rejected when
`Quu(['z'])` is accepted usually. Reopening.
--
More information about the Digitalmars-d-bugs
mailing list