[Issue 10573] Weird linking problem with associative array cast [DMD 2.63]
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jul 8 23:20:19 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10573
--- Comment #3 from Daniel Kozak <kozzi11 at gmail.com> 2013-07-08 23:20:16 PDT ---
(In reply to comment #2)
> Btw, I'd be very careful using casts on hashes like that, there's no runtime
> checking when you cast hashes, even if the key or value is a base class which
> is casted to a derived class. For example:
>
> -----
> class A { }
> class B : A { void call() { } }
>
> void main()
> {
> A[int] a;
> a[1] = new A();
>
> B[int] b = cast(B[int])a; // unsafe, no exceptions thrown
> b[1].call(); // crash
> }
> -----
Yes, I realize I can avoid this kind of cast in my case, so now the code is
more safe and compilable.
--
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