[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
Sun Feb 21 01:21:31 PST 2016


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

--- Comment #1 from Alexander Tumin <iamtakingiteasy at eientei.org> ---
I think it also worth mentioning that without an intermediate structure (not
possbile in my actual case, but theoretically):

--->3---
string[] result = foo!(0, cast(string[])([['z'], ""]));
template foo(size_t i, string[] data, string[] results = []) {
    static if (i < data.length) {
        enum def = data[i];
        enum foo = foo!(i+1, data, results ~ def);
    } else {
        enum foo = results;
    }
}
--->3---

it compiles both on 2.070.0 release and current git master.

--


More information about the Digitalmars-d-bugs mailing list