Open ebdd6ebc-1612-4e9b-aee1-f7d2b6361d5f opened 5 years ago
I have sent the following question to WG14:
In defect report #341 the following example was given:
void f(int (*)[sizeof(int (*)[*])]);
In the first response it was stated that there was consensus that this example should be invalid.
The final wording in the resolution seems to imply the opposite: That the example is valid.
Is the example valid or invalid?
I'll get back here when I get a reply.
Feel free to ask :)
Will you ask them, or should I do that?
Well, #341 says "There was consensus that the first example should be valid, and the second should be invalid." and there's no indication that that decision was reversed, so I'm still inclined to think that the C wording change fails to reflect the intent. It seems at least worth asking WG14 what they meant.
I tried to report the opposite behaviour in gcc as bug, but was then informed that the final resolusion of defect report 341 do allow such programs.
Defect report:
http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_341.htm
See discussion in the invalid gcc bug report:
I really don't think that's the intended interpretation of the C wording. To the extent that the above fails to violate C11 6.7.6.2/2 and /4, I think that's a bug in the wording.
The question never made it to the WG14 reflectors and the meeting minutes from Spring 2008 (https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1343.pdf) are effectively useless as to what the committee was thinking when making the decision.
I've asked on the committee reflectors what the intent and history is here.
I asked in reflector message: https://www.open-std.org/jtc1/sc22/wg14/23678 and have not yet heard a response.
Extended Description
Conside the following program (prog.c):
void f(int a[sizeof(int [*])]);
int main() { }
Compile it with the following command line:
clang prog.c -std=c11 -pedantic-errors
It incorrectly gives the following error:
error: star modifier used outside of function prototype
Compiling the program should give no error since it is well-formed according to C11.