[phobos] Questionable unit test in std.functional

Daniel Murphy yebblies at gmail.com
Sun Jul 3 05:47:57 PDT 2011


At the very bottom of std.functional, there is this unit test:

    /* test for linkage */
    {
        struct S
        {
            extern(C) static void xtrnC() {}
            extern(D) static void xtrnD() {}
        }
        auto dg_xtrnC = toDelegate(&S.xtrnC);
        auto dg_xtrnD = toDelegate(&S.xtrnD);
        static assert(! is(typeof(dg_xtrnC) == typeof(dg_xtrnD)));
    }

Is there any reason why dg_xtrnC and dg_xtrnD should have different types?
As far as I can tell the calling convention of the function should be
completely hidden.


More information about the phobos mailing list