Hi!
In the user's manual, section GCC extensions not implemented yet, I read:

clang does not support static initialization of flexible array members. This 
appears to be a rarely used extension, but could be implemented pending user 
demand.

I interpret this to say that the following program would not work, because bar would not be allocated space for an array y of three elements:

        struct foo {
                int x;
                int y[];
        };

        struct foo bar = {1, {2, 3, 4}};

However, testing shows that it does work and there is in fact a similar test case (https://github.com/llvm-mirror/clang/blob/master/test/Sema/flexible-array-init.c). A warning "flexible array initialization is a GNU extension" is printed only if -Wpedantic is enabled.

Am I reading the documentation wrong or is this a documentation error?

Best Regards,
Anton Eliasson
_______________________________________________
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

Reply via email to