RTTI support is broken ?

Ruslan Shevchenko Ruslan@Shevchenko.Kiev.UA
Sun Apr 5 21:29:00 GMT 1998


1:
#include ?iostream>
#include ?typeinfo>

using namespace std;

class X
{
public:
 virtual void x(void)  { cout ?? typeid(X).name() ?? endl; }
};

int main(void)
{
  X x;
  x.x();
  return 0;
}
#include ?iostream>
#include ?typeinfo>

using namespace std;

class X
{
public:
 virtual void x(void)  { cout ?? typeid(X).name() ?? endl; }
};

int main(void)
{
  X x;
  x.x();
  return 0;
}


In file included from /usr/local/include/g++/typeinfo:5,
                 from t9.cc:3:
/usr/local/include/g++/std/typeinfo.h:35: declaration of C function
`void * __th
row_type_match_rtti(void *, void *, void *)' conflicts with
?internal>:35: previous declaration `void *
__throw_type_match_rtti(const void *
, const void *, void *)' here
In file included from /usr/local/include/g++/std/typeinfo.h:243,
                 from /usr/local/include/g++/typeinfo:5,
                 from t9.cc:3:
/usr/local/include/g++/stdexcept:40: parse error before `{'
/usr/local/include/g++/stdexcept:44: virtual outside class declaration
/usr/local/include/g++/stdexcept:44: non-member function `what()' cannot
have `c
onst' method qualifier
/usr/local/include/g++/stdexcept: In function `const char * what()':
/usr/local/include/g++/stdexcept:44: `_what' undeclared (first use this
function
)
/usr/local/include/g++/stdexcept:44: (Each undeclared identifier is
reported onl
y once
/usr/local/include/g++/stdexcept:44: for each function it appears in.)
In file included from /usr/local/include/g++/typeinfo:5,
                 from t9.cc:3:
/usr/local/include/g++/std/typeinfo.h:35: declaration of C function
`void * __th
row_type_match_rtti(void *, void *, void *)' conflicts with
?internal>:35: previous declaration `void *
__throw_type_match_rtti(const void *
, const void *, void *)' here
In file included from /usr/local/include/g++/std/typeinfo.h:243,
                 from /usr/local/include/g++/typeinfo:5,
                 from t9.cc:3:
/usr/local/include/g++/stdexcept:40: parse error before `{'
/usr/local/include/g++/stdexcept:44: virtual outside class declaration
/usr/local/include/g++/stdexcept:44: non-member function `what()' cannot
have `c
onst' method qualifier
/usr/local/include/g++/stdexcept: In function `const char * what()':
/usr/local/include/g++/stdexcept:44: `_what' undeclared (first use this
function
)
/usr/local/include/g++/stdexcept:44: (Each undeclared identifier is
reported onl
y once
/usr/local/include/g++/stdexcept:44: for each function it appears in.)




2:
#include ?iostream>
//#include ?typeinfo>

using namespace std;

class X
{
public:
 virtual void x(void)  { cout ?? typeid(X).name() ?? endl; }
};

int main(void)
{
  X x;
  x.x();
  return 0;
}




goblin:$ gcc t9.cc -frtti -lstdc++ 2>?1
t9.cc: In method `void X::x()':
t9.cc:10: no matching function for call to `type_info::name () const'
goblin:$


goblin:$ gcc --version
egcs-2.91.19


--

    @=
     //RSSH                              mailto:Ruslan@Shevchenko.Kiev.UA






More information about the Gcc mailing list