I am trying to compile the following with MSVC2013:
class SomeClass
{
struct SomeStruct { bool a,b,c; };
SomeStruct ss{false, false, false};
}
The compiler gives me the following error: SomeClass::SomeStruct::SomeStruct: no overloaded function takes 3 arguments.
If I change the code to this:
class SomeClass
{
struct SomeStruct { bool a,b,c; };
SomeStruct ss{{false, false, false}};
}
the program compiles and runs fine. Is this a problem with the compiler, or do I not understand the syntax? From what I've been reading, the first version should compile.
Here is the responsible grammar from N3797:
So I'd say the first statement is correct and it is indeed accepted by a recent
gcc
andclang
.