[Issue 11452] IFTI failure for aliased static array parameter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 6 08:45:08 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11452


Simen Kjaeraas <simen.kjaras at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simen.kjaras at gmail.com


--- Comment #2 from Simen Kjaeraas <simen.kjaras at gmail.com> 2013-11-06 08:45:06 PST ---
I'm not sure this is something we actually do want. Consider:

template Foos(uint size, T) {
    static if (is(T == string)) {
        alias Foos = T[size*3];
    } else {
        alias Foos = T[size];
    }
}

void func(uint size, T)(Foos!(size, T)) {
}

void test() {
    string[6] a;
    func(a);
}


How is the poor compiler to figure out the values of size and T? An even
simpler example:

template Foos(uint size, T) {
    alias Foos = float;
}


Bottom line is, templates can be arbitrarily complex. This sort of matching can
only be done for very simple cases.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list