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

--- Comment #0 from Jacob Carlborg <> 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

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

Object bar () const
    return f;

I don't get any errors.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to