I am currently working with the fundamental types in C++, and there is some ambiguity (which I have tried to solve).
I am creating a function that needs an overload for _all_ fundamental types (in addition to a void *).
Some types overlap (like "unsigned wchar_t" and unsigned int, whilst wchar_t never overlaps), so, I would like some confirmation about my current overloads being complete and overlap-free on your system as well.
The types you listed before the program are all distinct types as guaranteed by the standard.
Your program involves a few pairs of same types: short and signedshort, int and signedint, long and signedlong, longlong and signedlonglong are the same, by definition.
it also has two errors, to quote clang,
1 2 3 4 5 6
main.cpp:19:14: warning: 'wchar_t' cannot be signed or unsigned [-Wpedantic]
m[typeid(unsignedwchar_t).hash_code()].push_back("unsigned wchar_t");
^
main.cpp:20:14: warning: 'wchar_t' cannot be signed or unsigned [-Wpedantic]
m[typeid(signedwchar_t).hash_code()].push_back("signed wchar_t");
^
or, using somewhat less-clear gcc,
1 2
test.cc:19:23: warning: long, short, signed or unsigned used invalidly for'type name' [-pedantic]
test.cc:20:21: warning: long, short, signed or unsigned used invalidly for'type name' [-pedantic]
PS: don't forget that for any non-reference non-function type there are three more distinct versions: const, volatile, and const volatile.
I read that it's a builtin type; but I have no idea how to read it or how to change an instantiation of it.
@Cubbi
I am aware that signed can be omitted. Also, it's quite weird that you get errors with signed and unsigned wchar_t types. TDM-GCC 4.8.1 has no problem at all. I'll check the C++ documentation.
Edit:
-pedantic-errors causes an error just like with you, I will omit these from code.