aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/gnu2x-complit-2.c
blob: 20cb38fd94ed5dc40f5c746961afabb67ca6c1ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* Test C2x storage class specifiers in compound literals.  Thread-local
   cases, compilation tests, GNU __thread used.  */
/* { dg-do compile } */
/* { dg-options "-std=gnu2x" } */
/* { dg-require-effective-target tls } */

#include <stddef.h>

/* __thread is OK at file scope, although of limited use since the
   thread-local object and its address are not constant expressions.  */
size_t st = sizeof (__thread int) { 1 };
size_t sst = sizeof (static __thread int) { 1 };

int *
f ()
{
  return &(static __thread int) { 2 };
}