site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On May 10, 2005, at 17:03, David Leimbach wrote: On 5/9/05, Hugh Hoover <hugh@hooverzone.com> wrote: Hi - I found a bug in the libc++v3 library with dynamic_cast and, rather than just wait for Apple to fix it, I'm trying to build my own so I can fix it myself as a work-around. _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... What's the bug? If you have a template class that uses a base class with virtual functions AND you have ANOTHER template that accepts the base class and does a dynamic_cast to the template class AND you're using dylibs or frameworks or.. (any separately linked form that might generate a local copy of the template), then the dynamic_cast will fail in any module other than the one that actually creates the object. This is because a new instance of the type_info is created for each module that has it's own instantiation of the template, and the dynamic_cast code (apparently) does not perform a normalized (non- instance-specific) comparison between the source and destination types. Was that as clear as mud? :) see my message in xcode- users@lists.apple.com on may 9 with the subject "bug?: templates, dynamic_cast and frameworks". It's slightly more clear. I also have a very short example that shows the problem in about 100 lines of code. I think now that I can work around the issue by only having a single instantiation of any template (-no-implicit-templates), but that's likely to be painful in the extreme. I'd rather have a proper dynamic_cast that doesn't depend on specific instances of type_info. This email sent to site_archiver@lists.apple.com