https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88718
Bug ID: 88718
Summary: Strange inconsistency between old style and new style
declarations of iinline functions.
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: anders.granlund.0 at gmail dot com
Target Milestone: ---
GCC is behaving inconsistently for the following two test cases:
prog1.c:
static int x;
inline void g(int a[sizeof(x)])
{
}
int main()
{
}
prog2.c:
static int x;
inline void g(a)
int a[sizeof(x)];
{
}
int main()
{
}
Compiling the first test case with the following compilation command line
gcc prog1.c -Wall -Wextra -std=c11 -pedantic-errors
gives no error message.
Compiling the second test case with the following compilation command line
gcc prog2.c -Wall -Wextra -std=c11 -pedantic-errors
gives the following error message:
error: 'x' is static but used in inline function 'g' which is not static
I think there should be an error message in both cases because of 6.7.4/3. At
least the two test cases should behave consistently.