view gcc/testsuite/g++.dg/tls/diag-1.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// Valid __thread specifiers.
// { dg-require-effective-target tls }

__thread int g1;
extern __thread int g2;
static __thread int g3;

void foo()
{
  extern __thread int l1;
  static __thread int l2;
}

struct A {
  static __thread int i;
};

__thread int A::i = 42;

template <typename T> struct B {
  static __thread T t;
};

template <typename T>
__thread T B<T>::t = 42;

void bar ()
{
  int j = B<int>::t;
  int k = B<const int>::t;
}