[Issue 9653] Wrong implicit cast allowed with inheritance

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 28 14:14:46 PDT 2013


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


Henning Pohl <henning at still-hidden.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |henning at still-hidden.de


--- Comment #1 from Henning Pohl <henning at still-hidden.de> 2013-07-28 14:14:44 PDT ---
Reduced:

class C {
    inout(TypeInfo) foo() pure inout {
        return typeid(Object);
    }
}

The problem is that by using typeid(Object) you can get access to a global
class instance (TypeInfo) in a pure function. And the result of pure functions
can be casted to be inout. But in this case you didn't create the class
instance by yourself. So only self-created TypeInfo-instances should be allowed
to get casted. These are hard to detect though.

-- 
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