]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/gnu2x-complit-2.c
testsuite: Refer more consistently to C23 not C2X
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / gnu2x-complit-2.c
1 /* Test C23 storage class specifiers in compound literals. Thread-local
2 cases, compilation tests, GNU __thread used. */
3 /* { dg-do compile } */
4 /* { dg-options "-std=gnu23" } */
5 /* { dg-require-effective-target tls } */
6
7 #include <stddef.h>
8
9 /* __thread is OK at file scope, although of limited use since the
10 thread-local object and its address are not constant expressions. */
11 size_t st = sizeof (__thread int) { 1 };
12 size_t sst = sizeof (static __thread int) { 1 };
13
14 int *
15 f ()
16 {
17 return &(static __thread int) { 2 };
18 }