1) std::cout<<&typeid(T)<<":"<<typeid(T).name()<<'\n'; 2) T t ; std::cout<<&typeid(t)<<":"<<typeid(t).name()<<'\n';
(Where T is a template class derived from some non-template base-class)
So the address of the type_info objects in line 1 and 2 are different, the names however are identical. I have searched a lot in the archives but have never seen a problem like this being reported (all problems reported are accross dynamic library boundaries)
The above problem occurs in a python extension module. So I wanted to regenerate the problem in a small test-case but only succeeded partially. In following small test-case I got a surprising (to me) result too:
<test> #include <iostream>
class A { public: virtual ~A() {} } ;
template < class T > class B {} ;
void main() { typedef B<int> Bint ; std::cout<<&typeid(Bint)<<":"<<typeid(Bint).name()<<'\n'; std::cout<<&typeid(Bint())<<":"<<typeid(Bint()).name()<<'\n'; Bint bint ; std::cout<<&typeid(bint)<<":"<<typeid(bint).name()<<'\n'; } ; </test>
the first and third cout print the same address and name, the second however prints another address and a name that can't even be demangled by c++filt ?!
Any ideas on how to investigate further the first problem and the reason for the second 'surprising result' would be greatly appreciated.
I'm using gcc 3.2 and ld 2.13.90.0.2 (RH8.0) for this test