Robert Greig wrote:
2008/6/3 Andrew Stitcher <[EMAIL PROTECTED]>:
I haven't done the googling, but it seems to be that statically I've got
a PollerHandle that as far as the code concerned knows came from a
DispatchHandle as far as this code is concerned there is no AsynchIO
involved at all. Locally there is no knowledge that private inheritance
is involved and there is none along the inheritance line that we are
casting up either. As private inheritance isn't between the PollerHandle
and the DispatchHandle I can't see why the dynamic_cast shouldn't
succeed. If I'd tried to cast to AsynchIO that should have failed.
Having looked at the issue in more detail I see now that it is not so
obvious why this doesn't work. It does look plausible to me. Sorry for
not looking at this more carefully before posting my original
response.
I will install VS 2008 on my machine and see what it says but my money
right now is that this will work on that platform and is a bug in the
Sun compiler.
I'm not so sure. The counter argument is: dynamic-cast operates on run time
types. The run-time type is AsyncIO. AsyncIO is not (publicly) a DispatchHandler
therefore the cast should fail.
Note the fact that we started from a PollerHandle (which is the argument for
letting this cast succeed) is gone at runtime unless the compiler takes pains to
keep it around.
I still don't know what the Real Truth from the C++ spec is but it's
sufficiently unclear that I think its worth avoiding.