The following code fails to compile in VS2015.
struct Foo
{
Foo(int value) { }
};
struct Moo
{
struct
{
Foo foo = 0;
} fooHolder;
};
int main()
{
Moo moo;
}
The following error is shown.
1>c:\xxx\main.cpp(81): error C2512: 'Foo' : no appropriate default constructor available
1> This diagnostic occurred in the compiler generated function 'Moo::<unnamed-type-fooHolder>::(void) restrict(cpu, amp)'
If the unnamed struct is given a name, the code compiles.
struct NamedHolder
{
Foo foo = 0;
} fooHolder;
The code compiled in clang and gcc. http://coliru.stacked-crooked.com/a/3b4ab035a967eed9
Is it rejecting valid code?