The following code
#include <iostream>
#include <new>
#include <cstring>
#include <type_traits>
template<typename T>
void is_pod(char* c)
{
cout << "Type " << c;
if(std::is_pod<T>::value)
::std::cout << " is POD" << endl;
else
::std::cout << " is not!" << endl;
}
#define CHECK_TYPE(ty) ::is_pod<ty>(#ty)
struct POD_Parent{};
struct POD_Child : public POD_Parent{int y;};
struct POD_Child2 {int x; POD_Parent y; POD_Child ssd;};
int main()
{
CHECK_TYPE(POD_Parent);
CHECK_TYPE(POD_Child);
CHECK_TYPE(POD_Child2);
Gives the following results: Which is strange!
Type POD_Parent is POD
Type POD_Child is not!
Type POD_Child2 is POD
How can POD_Child is not POD?! and POD_Child2 is POD?!!
Note that I compiled it using MinGW (using option -std=c++11) and it said that all of them are POD.