[Issue 9112] Uniform construction for built-in types

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 3 10:11:25 PDT 2014


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



--- Comment #32 from bearophile_hugs at eml.cc 2014-04-03 10:11:17 PDT ---
Unfortunately the syntax doesn't work for fixed-size arrays:

void foo(T, size_t N)(T[N] x) {
    pragma(msg, T);
}
void main() {
    uint x = 1_000;
    foo([x % 3, x % 200]);               // OK, uint
    foo(cast(ubyte[2])[x % 3, x % 200]); // OK, ubyte
    ubyte[2] aux = [x % 3, x % 200];
    foo(aux);                            // OK, ubyte
    foo(ubyte[2]([x % 3, x % 200]));     // error
}

-- 
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