Why does a zero-sized array force a struct to be zero sized when an otherwise empty struct has a size of 1, and why does inheriting from a non-zero-sized struct cause the struct to be inflated to the size of the base type?
Compiling via GCC 5.3.0, in case any answer depends on the c++ spec.
#include <iostream>
struct a {};
struct b { int x[0]; };
struct c : a{ int x[0]; };
struct d : b{ int x[0]; };
int main()
{
std::cout << sizeof(a) << std::endl; // 1
std::cout << sizeof(b) << std::endl; // 0
std::cout << sizeof(c) << std::endl; // 4
std::cout << sizeof(d) << std::endl; // 0
}