April 16, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7920

           Summary: Possible to return const object through mutable Object
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: doob@me.com


--- Comment #0 from Jacob Carlborg <doob@me.com> 2012-04-15 23:20:04 PDT ---
class Foo
{
    Foo f;

    Foo bar () const
    {
        return f;
    }
}

The above code results in the compile error:

Error: cannot implicitly convert expression (this.f) of type const(Foo) to
test.Foo

This is just as expected, but if I change "bar" to:

Object bar () const
{
    return f;
}

I don't get any errors.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 16, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7920


Steven Schveighoffer <schveiguy@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |schveiguy@yahoo.com
         Resolution|                            |DUPLICATE


--- Comment #1 from Steven Schveighoffer <schveiguy@yahoo.com> 2012-04-16 05:30:03 PDT ---
*** This issue has been marked as a duplicate of issue 3731 ***

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