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]

Re: g++ && rtti <typeinfo> problems


Thanx Mark!

 I admit it was a typo. A student came to me with this problem so I
typed it on the fly and got this result, same as those he got, except
this parse error before ':'. OK I have overseen it, but problem with
typeinfo is still there. 

 By the way can You compile this example??

 But thanks a lot for You answer.

 Sincerely
 	Miljenko

On Thu, 5 Mar 1998, Mark Mitchell wrote:

:>
:>    /*
:>     Newsgroups: gnu.g++.bug,gnu.g++.help,gnu.g++.lib.bug
:>     email     : egcs-bugs@cygnus.com, bug-g++@prep.ai.mit.edu
:>
:>     Hi!
:>
:>     Sorry for intrusion but I have (again) some misunderstandings
:>     with this example:
:>
:>    */
:>
:>    # include <typeinfo>
:>
:>    # include <iostream.h>
:>
:>    int main()
:>    {
:>     int i;
:>
:>     typeid(i);
:>
:>     cout << typeid(i).name() << endl:
:>
:>That's supposed to be a `;', not a `:'.
:>
:>     return 0;
:>    }
:>
:>
:>
:>-- 
:>Mark Mitchell		mmitchell@usa.net
:>Stanford University	http://www.stanford.edu
:>
:>


One more time :

/*
 Newsgroups: gnu.g++.bug,gnu.g++.help,gnu.g++.lib.bug
 email     : egcs-bugs@cygnus.com, bug-g++@prep.ai.mit.edu

 Hi!

 Sorry for intrusion but I have (again) some misunderstandings
 with this example:

*/

# include <typeinfo>

# include <iostream.h>

int main()
{
 int i;

 typeid(i);

 cout << typeid(i).name() << endl;

 return 0;
}


/*

Linux : 	egcs-1.0.2 snapshot 02.03(March).1998.
		with typeinfo incuded

cvjetko@zt92:/home/cvjet/gcl/example/Tests/egcs-1.0.1 > g++ -v v_2_90_frtti_problems.cpp
Reading specs from /usr/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.91.12/specs
gcc version egcs-2.91.12 980302 (gcc-2.8.0 release)
 /usr/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.91.12/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -Di386 -D
i586 -Asystem(unix) -Acpu(i386) -Amachine(i386) -D__i386__ -D__i586__ -Asystem(unix) -Acpu(i386) -Amachine(i386) v_2_90_frtti_problems.cpp /tmp/cca00222.ii
GNU CPP version egcs-2.91.12 980302 (gcc-2.8.0 release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/g++
 /usr/local/include
 /usr/i586-pc-linux-gnulibc1/include
 /usr/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.91.12/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.91.12/cc1plus /tmp/cca00222.ii -quiet -dumpbase v_2_90_frtti_problems.cc -version -o /tmp/cca00222.s
GNU C++ version egcs-2.91.12 980302 (gcc-2.8.0 release) (i586-pc-linux-gnulibc1) compiled by GNU C version egcs-2.91.12 980302 (gcc-2.8.0 release).
In file included from /usr/include/g++/typeinfo:5,
                 from v_2_90_frtti_problems.cpp:13:
/usr/include/g++/std/typeinfo.h:35: declaration of C function `void * __throw_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/include/g++/std/typeinfo.h:243,
                 from /usr/include/g++/typeinfo:5,
                 from v_2_90_frtti_problems.cpp:13:
/usr/include/g++/stdexcept:40: parse error before `{'
/usr/include/g++/stdexcept:44: virtual outside class declaration
/usr/include/g++/stdexcept:44: non-member function `what()' cannot have `const' method qualifier
/usr/include/g++/stdexcept: In function `const char * what()':
/usr/include/g++/stdexcept:44: `_what' undeclared (first use this function)
/usr/include/g++/stdexcept:44: (Each undeclared identifier is reported only once
/usr/include/g++/stdexcept:44: for each function it appears in.)
/usr/include/g++/stdexcept: At top level:
/usr/include/g++/stdexcept:47: base class `logic_error' has incomplete type
/usr/include/g++/stdexcept: In method `domain_error::domain_error(const class basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > &)':
/usr/include/g++/stdexcept:49: type `logic_error' is not an immediate basetype for `domain_error'
/usr/include/g++/stdexcept: At top level:
/usr/include/g++/stdexcept:52: base class `logic_error' has incomplete type
/usr/include/g++/stdexcept: In method `invalid_argument::invalid_argument(const class basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > &)':
/usr/include/g++/stdexcept:54: type `logic_error' is not an immediate basetype for `invalid_argument'
/usr/include/g++/stdexcept: At top level:
/usr/include/g++/stdexcept:57: base class `logic_error' has incomplete type
/usr/include/g++/stdexcept: In method `length_error::length_error(const class basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > &)':
/usr/include/g++/stdexcept:59: type `logic_error' is not an immediate basetype for `length_error'
/usr/include/g++/stdexcept: At top level:
/usr/include/g++/stdexcept:62: base class `logic_error' has incomplete type
/usr/include/g++/stdexcept: In method `out_of_range::out_of_range(const class basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > &)':
/usr/include/g++/stdexcept:64: type `logic_error' is not an immediate basetype for `out_of_range'
/usr/include/g++/stdexcept: At top level:
/usr/include/g++/stdexcept:67: parse error before `{'
/usr/include/g++/stdexcept:71: virtual outside class declaration
/usr/include/g++/stdexcept:71: non-member function `what()' cannot have `const' method qualifier
/usr/include/g++/stdexcept: In function `const char * what()':
/usr/include/g++/stdexcept:71: redefinition of `const char * what()'
/usr/include/g++/stdexcept:44: `const char * what()' previously defined here
/usr/include/g++/stdexcept: At top level:
/usr/include/g++/stdexcept:72: parse error before `protected'
/usr/include/g++/stdexcept:76: base class `runtime_error' has incomplete type
/usr/include/g++/stdexcept: In method `range_error::range_error(const class basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > &)':
/usr/include/g++/stdexcept:78: type `runtime_error' is not an immediate basetype for `range_error'
/usr/include/g++/stdexcept: At top level:
/usr/include/g++/stdexcept:81: base class `runtime_error' has incomplete type
/usr/include/g++/stdexcept: In method `overflow_error::overflow_error(const class basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > &)':
/usr/include/g++/stdexcept:83: type `runtime_error' is not an immediate basetype for `overflow_error'
/usr/include/g++/stdexcept: At top level:
/usr/include/g++/stdexcept:86: base class `runtime_error' has incomplete type
/usr/include/g++/stdexcept: In method `underflow_error::underflow_error(const class basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > &)':
/usr/include/g++/stdexcept:88: type `runtime_error' is not an immediate basetype for `underflow_error'
/usr/include/g++/stdexcept: At top level:
/usr/include/g++/stdexcept:91: parse error before `}'


Linux : 	egcs-1.0.2 snapshot 02.03(March).1998.
		without typeinfo incuded

cvjetko@zt92:/home/cvjet/gcl/example/Tests/egcs-1.0.1 > g++ -v v_2_90_frtti_problems.cpp
Reading specs from /usr/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.91.12/specs
gcc version egcs-2.91.12 980302 (gcc-2.8.0 release)
 /usr/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.91.12/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -Di386 -D
i586 -Asystem(unix) -Acpu(i386) -Amachine(i386) -D__i386__ -D__i586__ -Asystem(unix) -Acpu(i386) -Amachine(i386) v_2_90_frtti_problems.cpp /tmp/cca00227.ii
GNU CPP version egcs-2.91.12 980302 (gcc-2.8.0 release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/g++
 /usr/local/include
 /usr/i586-pc-linux-gnulibc1/include
 /usr/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.91.12/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.91.12/cc1plus /tmp/cca00227.ii -quiet -dumpbase v_2_90_frtti_problems.cc -version -o /tmp/cca00227.s
GNU C++ version egcs-2.91.12 980302 (gcc-2.8.0 release) (i586-pc-linux-gnulibc1) compiled by GNU C version egcs-2.91.12 980302 (gcc-2.8.0 release).
v_2_90_frtti_problems.cpp: In function `int main()':
v_2_90_frtti_problems.cpp:22: no matching function for call to `type_info::name () const'

----------------------------------------------------------------------------------------------

HPUX : 		egcs-1.0.1 snapshot 
		with typeinfo incuded

zt55:gcl/example/Tests/egcs-1.0.1[1491]$> g++ -v v_2_90_frtti_problems.cpp
Reading specs from /usr/local/lib/gcc-lib/hppa1.1-hp-hpux10.20/egcs-2.90.23/specs
gcc version egcs-2.90.23 980102 (egcs-1.0.1 release)
 /usr/local/lib/gcc-lib/hppa1.1-hp-hpux10.20/egcs-2.90.23/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=90 -Dhppa -Dhp9000s800 -D__hp9000s800 -Dhp9k8 -DPWB -Dhpux -Dunix -D__hppa__ -D__hp9000s800__ -D__hp9000s800 -D__hp9
k8__ -D__PWB__ -D__hpux__ -D__unix__ -D__hppa -D__hp9000s800 -D__hp9k8 -D__PWB -D__hpux -D__unix -Asystem(unix) -Asystem(hpux) -Acpu(hppa) -Amachine(hppa) -D__EXCEPTIONS -D__hp9000s700 -D_PA_RISC1_1 -D_HPUX_SOURCE -D_HIUX_SOURCE v_2_90_frtti_problems.cpp 
/var/tmp/cca19700.ii
GNU CPP version egcs-2.90.23 980102 (egcs-1.0.1 release) (hppa)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include/g++
 /usr/local/lib/g++-include
 /usr/local/include
 /usr/local/hppa1.1-hp-hpux10.20/include
 /usr/local/lib/gcc-lib/hppa1.1-hp-hpux10.20/egcs-2.90.23/include
 /usr/include
End of search list.
 /usr/local/lib/gcc-lib/hppa1.1-hp-hpux10.20/egcs-2.90.23/cc1plus /var/tmp/cca19700.ii -quiet -dumpbase v_2_90_frtti_problems.cc -version -o /var/tmp/cca19700.s
GNU C++ version egcs-2.90.23 980102 (egcs-1.0.1 release) (hppa1.1-hp-hpux10.20) compiled by GNU C version egcs-2.90.23 980102 (egcs-1.0.1 release).
In file included from /usr/local/lib/g++-include/std/typeinfo.h:243,
                 from /usr/local/lib/g++-include/typeinfo:5,
                 from v_2_90_frtti_problems.cpp:12:
/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 `const' 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 only once
/usr/local/include/g++/stdexcept:44: for each function it appears in.)
/usr/local/include/g++/stdexcept: At top level:
/usr/local/include/g++/stdexcept:47: base class `logic_error' has incomplete type
/usr/local/include/g++/stdexcept: In method `domain_error::domain_error(const class basic_string<char,string_char_traits<char> > &)':
/usr/local/include/g++/stdexcept:49: type `logic_error' is not an immediate basetype for `domain_error'
/usr/local/include/g++/stdexcept: At top level:
/usr/local/include/g++/stdexcept:52: base class `logic_error' has incomplete type
/usr/local/include/g++/stdexcept: In method `invalid_argument::invalid_argument(const class basic_string<char,string_char_traits<char> > &)':
/usr/local/include/g++/stdexcept:54: type `logic_error' is not an immediate basetype for `invalid_argument'
/usr/local/include/g++/stdexcept: At top level:
/usr/local/include/g++/stdexcept:57: base class `logic_error' has incomplete type
/usr/local/include/g++/stdexcept: In method `length_error::length_error(const class basic_string<char,string_char_traits<char> > &)':
/usr/local/include/g++/stdexcept:59: type `logic_error' is not an immediate basetype for `length_error'
/usr/local/include/g++/stdexcept: At top level:
/usr/local/include/g++/stdexcept:62: base class `logic_error' has incomplete type
/usr/local/include/g++/stdexcept: In method `out_of_range::out_of_range(const class basic_string<char,string_char_traits<char> > &)':
/usr/local/include/g++/stdexcept:64: type `logic_error' is not an immediate basetype for `out_of_range'
/usr/local/include/g++/stdexcept: At top level:
/usr/local/include/g++/stdexcept:67: parse error before `{'
/usr/local/include/g++/stdexcept:71: virtual outside class declaration
/usr/local/include/g++/stdexcept:71: non-member function `what()' cannot have `const' method qualifier
/usr/local/include/g++/stdexcept: In function `const char * what()':
/usr/local/include/g++/stdexcept:71: redefinition of `const char * what()'
/usr/local/include/g++/stdexcept:44: `const char * what()' previously defined here
/usr/local/include/g++/stdexcept: At top level:
/usr/local/include/g++/stdexcept:72: parse error before `protected'
/usr/local/include/g++/stdexcept:76: base class `runtime_error' has incomplete type
/usr/local/include/g++/stdexcept: In method `range_error::range_error(const class basic_string<char,string_char_traits<char> > &)':
/usr/local/include/g++/stdexcept:78: type `runtime_error' is not an immediate basetype for `range_error'
/usr/local/include/g++/stdexcept: At top level:
/usr/local/include/g++/stdexcept:81: base class `runtime_error' has incomplete type
/usr/local/include/g++/stdexcept: In method `overflow_error::overflow_error(const class basic_string<char,string_char_traits<char> > &)':
/usr/local/include/g++/stdexcept:83: type `runtime_error' is not an immediate basetype for `overflow_error'
/usr/local/include/g++/stdexcept: At top level:
/usr/local/include/g++/stdexcept:86: base class `runtime_error' has incomplete type
/usr/local/include/g++/stdexcept: In method `underflow_error::underflow_error(const class basic_string<char,string_char_traits<char> > &)':
/usr/local/include/g++/stdexcept:88: type `runtime_error' is not an immediate basetype for `underflow_error'
/usr/local/include/g++/stdexcept: At top level:
/usr/local/include/g++/stdexcept:91: parse error before `}'



HPUX : 		egcs-1.0.1 snapshot 
		without typeinfo incuded

zt55:gcl/example/Tests/egcs-1.0.1[1491]$> g++ -v v_2_90_frtti_problems.cpp
Reading specs from /usr/local/lib/gcc-lib/hppa1.1-hp-hpux10.20/egcs-2.90.23/specs
gcc version egcs-2.90.23 980102 (egcs-1.0.1 release)
 /usr/local/lib/gcc-lib/hppa1.1-hp-hpux10.20/egcs-2.90.23/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=90 -Dhppa -Dhp9000s800 -D__hp9000s800 -Dhp9k8 -DPWB -Dhpux -Dunix -D__hppa__ -D__hp9000s800__ -D__hp9000s800 -D__hp9
k8__ -D__PWB__ -D__hpux__ -D__unix__ -D__hppa -D__hp9000s800 -D__hp9k8 -D__PWB -D__hpux -D__unix -Asystem(unix) -Asystem(hpux) -Acpu(hppa) -Amachine(hppa) -D__EXCEPTIONS -D__hp9000s700 -D_PA_RISC1_1 -D_HPUX_SOURCE -D_HIUX_SOURCE v_2_90_frtti_problems.cpp 
/var/tmp/cca19697.ii
GNU CPP version egcs-2.90.23 980102 (egcs-1.0.1 release) (hppa)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include/g++
 /usr/local/lib/g++-include
 /usr/local/include
 /usr/local/hppa1.1-hp-hpux10.20/include
 /usr/local/lib/gcc-lib/hppa1.1-hp-hpux10.20/egcs-2.90.23/include
 /usr/include
End of search list.
 /usr/local/lib/gcc-lib/hppa1.1-hp-hpux10.20/egcs-2.90.23/cc1plus /var/tmp/cca19697.ii -quiet -dumpbase v_2_90_frtti_problems.cc -version -o /var/tmp/cca19697.s
GNU C++ version egcs-2.90.23 980102 (egcs-1.0.1 release) (hppa1.1-hp-hpux10.20) compiled by GNU C version egcs-2.90.23 980102 (egcs-1.0.1 release).
v_2_90_frtti_problems.cpp: In function `int main()':
v_2_90_frtti_problems.cpp:22: no matching function for call to `type_info::name () const'

*/



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