Declaring anonymous struct in for loop, clang fails to compile
问题 Code declaring anonymous structs in a for loop worked fine in gcc with -std=c99/gnu99 for (struct {int foo; int bar;} i = {0}; i.foo < 10; i.foo++); However when I switch to clang instead I got the error: error: declaration of non-local variable in 'for' loop Why is this an error? Why would it allow some types (e.g. "int") but not others (e.g. struct {int foo;}) ? This seems inconsistent. Does clang fail to implement c99 correctly or is that code invalid c99 and gcc just happens to support it