Doubtful warning

Carlo Wood carlo@runaway.xs4all.nl
Mon Jan 25 18:25:00 GMT 1999


Hi, I am not sure - but it might be that the following isn't intended.
I did run into this while writing my own demangler (to pretty print
a typeid().name()).

----------------------------------------------------
#include <iostream>
#include <typeinfo>

template<unsigned int i>
class A {};

int main(void)
{
  A<4294967295> v;

  const type_info &tir = typeid(v);
  cout << "v is a " << tir.name() << '\n';

  return 0;
}
----------------------------------------------------

Gives:

>g++ bug.cc
bug.cc: In function `int main()':
bug.cc:9: warning: decimal integer constant is so large that it is unsigned

The template parameter *is* unsigned - so why do I get this warning?

The mangled name also seems to use signed:

>a.out
v is a t1A1Uim1

Note that "Uim1" means: (unsigned int)-1

It could have been "Ui4294967295", but I guess that doesn't matter.

-- 
 Carlo Wood  <carlo@runaway.xs4all.nl>

PS  Please CC me if you reply to the list.

PS2 Fyi, the demangler of egcs is not capable of demangling
    a non-type template parameter `pointer to function'.
    If any incapability to demangle (obscure) mangled names
    is a problem, let me know and I'll give more info :).



More information about the Gcc-bugs mailing list