This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/11405] New: dynamic_cast error / problems


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11405

           Summary: dynamic_cast error / problems
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ruben at ugr dot es
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu

Using dynamic_cast gives a linker error. Some symbols fail to be generated.
Below is a small program which triggers the problem.
Similar problems give 'cannot dynamic_cast to pointer or reference to incomplete
type' 

#gcc -v
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/specs
Configured with: ./configure  : (reconfigured) ./configure
Thread model: posix
gcc version 3.3
#uname -a
Linux blackhole 2.4.21 #1 Wed Jun 18 15:27:56 CEST 2003 i686 unknown
# cat a.C
class A {
public:
int i;
virtual void E()=0;
};

class B: public A {
int j;
};


class C: public B {
int k;
void E() {}
};

int main (void)
{
A* a= new C();

B* b=dynamic_cast<B*>(a);
return 0;
}
# gcc a.C
/tmp/ccYexiCM.o(.text+0x19): In function `main':
: undefined reference to `operator new(unsigned)'
/tmp/ccYexiCM.o(.text+0x60): In function `main':
: undefined reference to `__dynamic_cast'
/tmp/ccYexiCM.o(.gnu.linkonce.r._ZTI1A+0x0): undefined reference to `vtable for
__cxxabiv1::__class_type_info'
/tmp/ccYexiCM.o(.gnu.linkonce.r._ZTI1B+0x0): undefined reference to `vtable for
__cxxabiv1::__si_class_type_info'
/tmp/ccYexiCM.o(.gnu.linkonce.r._ZTI1C+0x0): undefined reference to `vtable for
__cxxabiv1::__si_class_type_info'
/tmp/ccYexiCM.o(.gnu.linkonce.r._ZTV1B+0x8): undefined reference to
`__cxa_pure_virtual'
/tmp/ccYexiCM.o(.gnu.linkonce.r._ZTV1A+0x8): undefined reference to
`__cxa_pure_virtual'
/tmp/ccYexiCM.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]