On Saturday, July 07, 2012 07:27:52 Alex Rønne Petersen wrote: > Is overriding a @safe function with @trusted allowed/meant to be > allowed? I hope so, otherwise this is going to be a severe limitation.
Well, an overriding function in a derived class cannot be any looser than the one it's overriding in the base class, but @trusted is essentially the same as @safe from the caller's perspective, so I would expect it to work (I wouldn't expect @system to work though, since that _is_ looser). In fact, I'm pretty sure that there was a post about it not too long ago where someone was having issues because the function in a derived class was inferred as @safe, and they had to mark it as @trusted to get it to work. So, I think that you're fine on that count. However, even if you _couldn't_ override an @safe function with an @trusted one for some reason, all you would have to do is create a helper function which was @trusted, and you could get around the limitation quite easily. - Jonathan M Davis