| Issue |
87867
|
| Summary |
getting: "error: initializer element is not a compile-time constant" Even when struct is inside function
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
aalmkainzi
|
```C
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`
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs