#include <iostream>
#include <type_traits>
struct base_pod_t {
unsigned x;
};
struct der_pod_t : public base_pod_t { };
int main()
{
std::cout << "base_pod_t is POD: " << std::is_pod<base_pod_t>::value << std::endl;
std::cout << "der_pod_t is POD: " << std::is_pod<der_pod_t>::value << std::endl;
base_pod_t b1 = {}; // OK
base_pod_t b2 = {3}; // OK
der_pod_t p1 = {}; // OK
// der_pod_t p2 = {4}; // ERROR!
}
Last line results in error. How can I brace initialize der_pod_t
with value?
It seems that even though it's a POD it tries to use constructor?
EDIT:
As @Praetorian and @dyb suggested it is a POD thus result of std::is_pod<der_pod_t>::value
is correct.