[Issue 5851] New: Ambiguous alias this accepted.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Apr 17 06:58:39 PDT 2011


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

           Summary: Ambiguous alias this accepted.
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: blood.of.life at gmail.com


--- Comment #0 from Bernard Helyer <blood.of.life at gmail.com> 2011-04-17 06:55:06 PDT ---
import std.stdio;

class Foo
{
    this() { o = new Object(); }
    Object o;
    alias o this;

    override string toString()
    {
        return "Foo";
    }
}

void foo(Object o)
{
    writeln(o);
}

void main()
{
    foo(new Foo());
}


The code compiles, and prints "Foo". After discussing with Andrei, I believe
this code is an error.

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


More information about the Digitalmars-d-bugs mailing list