g++ 2.8 and rtti

Kriang Lerdsuwanakij lerdsuwa@scf-fs.usc.edu
Fri Feb 6 12:51:00 GMT 1998


David Sagnol wrote:
 
   I have a problem when I try to compile this simple programme with the
   new g++ 2.8
   It worked fine with g++ 2.7.2
  
   #include <typeinfo>
   #include <iostream.h>
  
   int main()
   {
       typeid(signed char);
   }
   
   Result :
  
   > g++ file.cc
   /tmp/cca280541.o: In function `main':
   /tmp/cca280541.o(.text+0x4): undefined reference to `__tfSc'
  
   or with egcs 1.0.1 :
  
   > eg++ file.cc
   /tmp/cca280411.o: In function `main':
   /tmp/cca280411.o(.text+0x4): undefined reference to `signed char
   type_info function'
   collect2: ld returned 1 exit status
  
   Everything is ok if I use an other builtin type.
   What's wrong?
  
   David

It's a bug in the compiler.  Only type_info code of char and unsigned
char is built into libgcc2.a.  Here is the patch that fixes your
problem. :)

Kriang


ChangeLog:
	* tinfo2.cc: Add type_info for signed char.

========================CUT HERE=====================
diff -rNpc3 gcc-old/cp/tinfo2.cc gcc/cp/tinfo2.cc
*** gcc-old/cp/tinfo2.cc	Thu Feb  5 22:23:45 1998
--- gcc/cp/tinfo2.cc	Thu Feb  5 22:24:53 1998
*************** extern "C" const type_info &__tf##mangle
*** 322,324 ****
--- 322,325 ----
  BUILTIN (v); BUILTIN (x); BUILTIN (l); BUILTIN (i); BUILTIN (s);
BUILTIN (b);
  BUILTIN (c); BUILTIN (w); BUILTIN (r); BUILTIN (d); BUILTIN (f);
  BUILTIN (Ui); BUILTIN (Ul); BUILTIN (Ux); BUILTIN (Us); BUILTIN (Uc);
+ BUILTIN (Sc);



More information about the Gcc-bugs mailing list