<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/87867>87867</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            getting: "error: initializer element is not a compile-time constant" Even when struct is inside function
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          aalmkainzi
      </td>
    </tr>
</table>

<pre>
    ```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`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0U82OszgQfBpzaQ0yhgA5cEgmE2nvc18ZaKB3jR3ZTebn6VcmJDOrHe3l0ydFoeSuLrqKtg6BRovYiN1R7E6JXnhyvtHazH9rsp-UtK7_aEQpb79nIU9CHsgyDM4JVUck1EEL9QwRt0LtbxxRHW8APPLiLUiRH--l0wYearMmK1T9QzfAKvz-6I4nQtWB_dIxfBH544JuEKq-TSZU-S_WqsIiP0J8vdqL6pgyiPwE76I6pRwdyHiu9ittU32QZUT_dXBP5rshnhB0664Inevj33whgwHeiCcYuw607YG7LoV2YRg0ma3WGW3H9LvU64SA3jsPf8CIDBREfoAf343e_8kYOO1EfsikyA9FHclrewRkiUkb-kQPaHBGG_XAOgZ9H_KJaY4T28Da8u9NdvdyQ9nmcESLXjP26f9k-zpR2PgBcQ7ADlqEIfYb12oDscKaqYOr9qRbgyFOsEYda25G8KiDs9E9expH9GRHwCta4Mkt4wTxE97bI63HgSz2QDZQj6BhWGzH5Oz6LR-nopRbWKVM-ibv9_leJ9hkVabyWqqySqamy3tEOXTYDkqWvd5lRZHty0ziUNdatQk1SqpCFrKUuyyTVapUkddVp2VZF3mBtSgkzppMasx1Tp0fEwphwaau6rJKjG7RhPVKK2XxDdaiUCrecN_Enqd2GYMopKHA4UuFiQ02IzKTHddFU-pX1kcpeImhvk1oYVsYCve47hEmizfNxHyJuy3UWajzSDwtbdq5WahzHG97PF28-ws7Fuq8mgpCnVfT_wQAAP__X5RwbQ">