[Issue 678] Compiler accepts, for a function T[] t(), t().ptr but not t.ptr

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Sep 15 07:51:16 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=678





------- Comment #2 from davidl at 126.com  2007-09-15 09:51 -------
previous code compiles with DMD 1.021, don't know if any ealier version fixes
the behavior, while the following ambiguous is related to this change
(mentioned by h3)
void[] t(){return null;}
class v
{
        void[] k(){return null;};
}
void main()
{
                void[] delegate() dg;
                auto inst= new v;
                dg= &inst.k;
                assert(dg().ptr is null);
                assert(dg.ptr is null);
        void* m;
        m=t().ptr;    //compiles
        m=t.ptr;      // fails, i'm worry about if let it through , maybe we
will have buggy code. but due to D's documentation this should be compiled
}


-- 



More information about the Digitalmars-d-bugs mailing list