www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5851] New: Ambiguous alias this accepted.

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: blood.of.life gmail.com



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: -------
Apr 17 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5851


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei metalanguage.com



06:56:37 PDT ---
Yah, it's a simple case of unreachable code - the alias this would never ever
get a chance. This needs to be rejected.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 17 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5851


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |yebblies gmail.com
           Platform|Other                       |All
         AssignedTo|nobody puremagic.com        |yebblies gmail.com
         OS/Version|Linux                       |All



https://github.com/D-Programming-Language/dmd/pull/676

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 01 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5851




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/51106f05fe3cf3abd2650ddd316eaaeedafc9fc6
Issue 5851 - Ambiguous alias this accepted

Disallow alias this when the aggregate type implicitly converts to the aliased
type.

Fixes issue 5851.

https://github.com/D-Programming-Language/dmd/commit/bc83600d34f6f7d5c5effdaa3c9ed635701b6953


Issue 5851 - Ambiguous alias this accepted

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 17 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5851


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |FIXED


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