MSVC12 thinks aggregate derived from std::array is not pod
c++, static-assert, visual-c++
Solution
GCC and Clang; that class is POD.
That depends on what exactly you mean with "make MSVC treat the class as pod." If you mean the compiler internals, then no. However, you can (in practice) specialise the trait for `litmus`:
namespace std {
template <>
struct is_pod<litmus> : std::true_type
{};
}
Note that going strictly by the standard, this gives undefined behaviour (thanks @R.MartinhoFernandes for pointing this out). However, as a compiler-specific workaround, I'd expect it to work. Use without any warranty.
Problem
Given the following ``` #include <array> struct litmus final : std::array<unsigned char, 16> { }; static_assert(std::is_pod<std::array<unsigned char, 16> >::value, "not pod"); // this fails on MSVC: static_assert(std::is_pod<litmus>::value, "not pod"); ``` The following compilers agree that `litmus` is pod: - clang++ version 3.5 (trunk 198621) http://coliru.stacked-crooked.com/a/7add7a2fe58a7e38 - g++ 4.8.1 http://coliru.stacked-crooked.com/a/74cfe97f06c8c128 However, MSVC12 (VS2013 RTM) maintains that the second assert fails. - Who's right? - Is there any trick to make MSVC treat the class as pod? EDIT For information: `is_trivially_copyable<litmus>` returns true-ness on MSVC. This might be useful for many cases where actual POD-ness isn't strictly required.