std::is_pod vs std::tr1::is_pod and void type

Mateusz Loskot mateusz@loskot.net
Sun Nov 15 03:21:00 GMT 2009


Hi,

I'm calling with is_pod and has_trivial_destructor against void type
and depending on which namespace the traits come from, they give
different results:

$ g++ --version
g++ (Ubuntu 4.4.1-4ubuntu8) 4.4.1

$ cat void.cpp
#include <iostream>
#include <tr1/type_traits>
int main()
{
    using std::cout; using std::endl;
    cout << std::tr1::is_pod<void>::value << endl;
    cout << std::tr1::has_trivial_destructor<void>::value << endl;

    cout << std::is_pod<void>::value << endl;
    cout << std::has_trivial_destructor<void>::value << endl;
}

$ g++ -Wall -pedantic -std=c++0x void.cpp

$ ./a.out
1
1
0
0

Why are the result different?
Is this a bug and should I report it?


It's an interesting issue and some time ago I discussed this
issue on comp.std.c++ [1] and it looks that I might have
blamed Visual C++ 9.0 unfairly. I'd appreciate if
anybody could clarify which compiler is correct.

[1]
http://groups.google.com/group/comp.std.c++/browse_thread/thread/01381d52adc619d6/

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org



More information about the Libstdc++ mailing list