150
|
1 // RUN: %clang_cc1 -emit-llvm -std=c++11 -triple x86_64-pc-linux-gnu -o- %s | FileCheck %s
|
|
2
|
|
3 // Global @x:
|
|
4 // CHECK: [[X_GLOBAL:@[^ ]+]]{{.*}}thread_local global
|
|
5
|
|
6 // returned somewhere in TLS wrapper:
|
236
|
7 // CHECK: define {{.+}} ptr @_ZTW1x(
|
|
8 // CHECK: [[X_GLOBAL_ADDR:%[^ ]+]] = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 [[X_GLOBAL]])
|
|
9 // CHECK: ret{{.*}}[[X_GLOBAL_ADDR]]
|
150
|
10
|
|
11 template <typename T> class unique_ptr {
|
|
12 template <typename F, typename S> struct pair {
|
|
13 F first;
|
|
14 S second;
|
|
15 };
|
|
16 pair<T *, int> data;
|
|
17 public:
|
|
18 constexpr unique_ptr() noexcept : data() {}
|
|
19 explicit unique_ptr(T *p) noexcept : data() {}
|
|
20 };
|
|
21
|
|
22 thread_local unique_ptr<int> x;
|
|
23 int main() { x = unique_ptr<int>(new int(5)); }
|