[Bug c++/16018] New: dynamic_cast fail accross shared libraries
amos at ilogix dot com
gcc-bugzilla@gcc.gnu.org
Wed Jun 16 12:01:00 GMT 2004
dynamic_cast<> sometimes fail when declaring a class in one shared library,
allocating an object (Base*in another shared library, passing a pointer of a
base to the third shared library and using dynamic_cast to down cast.
Note (1): the base and the derived are defined in different shared libraries.
Note (2): the shared libraries are statically linked (e.g. loaded at the
application initialization).
This is a critical issue since it breaks the ability to use RTTI in large
applications.
-------------------
Illustration
-------------------
[libx1.so]
class B
{
...
};
[libx2.so]
class D : public B
{
...
};
[libx3.so]
B* b = new D;
[libx4.so]
D* d = dynamic_cast<D*>(b);
assert(d != 0); // FAIL
--
Summary: dynamic_cast fail accross shared libraries
Product: gcc
Version: 3.2
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: amos at ilogix dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
GCC host triplet: Red Hat Linux 8.0
GCC target triplet: Red Hat Linux 8.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16018
More information about the Gcc-bugs
mailing list