[Issue 2270] cast produces invalid arrays at runtime
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jul 11 09:13:59 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=2270
--- Comment #10 from Steven Schveighoffer <schveiguy at yahoo.com> 2011-07-11 09:08:48 PDT ---
(In reply to comment #9)
> On a semi-related but not all that related note
Interesting :)
> I would point out to Steven
> that Kenji has made pull requests related to std.conv.to, one of which will
> make std.conv.to use opCast for user-defined conversions if a user-defined type
> has an opCast, so if you don't think that opCast should be used for such
> situations (that is, if you equate that to dangerous as you've been discussing
> here), then you should comment on the pull request:
calling opCast!(T) directly is not nearly as dangerous as using cast(T). It is
expected that opCast does not do unsafe things. Plus it is a regular function,
so it must obey the type system (unless of course it uses casts underneath).
In particular, it does *not* affect const/immutable unless opCast is
specifically written to do so.
So I have no problem with opCast being called from std.conv.to.
Actually, I'm looking at std.conv.to in that pull request and see a significant
bug, because cast is so dangerous! (will file in a minute)
--
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