This code fails to compile. I get "Expected { or ," at the point indicated. (Xcode 5, so it's a reasonably complete C++11 compiler.)
Is there a way to initialize a member of the nested union in a constructor initializer list, or do I just have to do it in the constructor body?
class Foo
{
public:
Foo(): m_bar.m_x(123) { }
private: // ^ error here
union
{
union
{
int m_x;
float m_y;
}
m_pod;
std::string m_name;
};
};