Möglicher Compiler-Fehler in MSVC12 (VS2013) mit festgelegtem Initialisierer
Bei der Verwendung von VS2013 Update 2 bin ich auf eine seltsame Fehlermeldung gestoßen:
// test.c
int main(void)
{
struct foo {
int i;
float f;
};
struct bar {
unsigned u;
struct foo foo;
double d;
};
struct foo some_foo = {
.i = 1,
.f = 2.0
};
struct bar some_bar = {
.u = 3,
// error C2440 : 'initializing' : cannot convert from 'foo' to 'int'
.foo = some_foo,
.d = 4.0
};
// Works fine
some_bar.foo = some_foo;
return 0;
}
Sowohl GCC als auch Clang akzeptieren es.
Vermisse ich etwas oder enthüllt dieser Code einen Compiler-Fehler?