Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / gcc.dg / c2x-complit-3.c
blobc672525ba6f608179dfa1abd551c4d0cfa4789af
1 /* Test C2x storage class specifiers in compound literals. Thread-local
2 cases, compilation tests. */
3 /* { dg-do compile } */
4 /* { dg-options "-std=c2x -pedantic-errors" } */
5 /* { dg-require-effective-target tls } */
7 #include <stddef.h>
9 /* thread_local 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_local int) { 1 };
12 size_t sst = sizeof (static thread_local int) { 1 };
14 int *
15 f ()
17 return &(static thread_local int) { 2 };
20 int *
21 g ()
23 return &(thread_local static int) { 3 };