Closed
Description
int foo(int *a, int b)
{
return 0;
}
int main()
{
int x;
(struct {
typeof(foo(&(struct { int t; }){.t = x}.t, 0)) t;
}){0};
}
the above code compiles with gcc and tcc. but fails with clang.
The error I get is:
err_test.c:10:48: error: initializer element is not a compile-time constant
typeof(foo(&(struct { int t; }){.t = x}.t, 0)) t;
^
1 error generated.
This error seems to be for global or static variables, but for some reason is triggering even though the variable is defined inside a function and inside a typeof