xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/pr18635.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -emit-llvm -std=c++11 -triple x86_64-pc-linux-gnu -o- %s | FileCheck %s
2*0a6a1f1dSLionel Sambuc 
3*0a6a1f1dSLionel Sambuc // Global @x:
4*0a6a1f1dSLionel Sambuc // CHECK: [[X_GLOBAL:@[^ ]+]]{{.*}}thread_local global
5*0a6a1f1dSLionel Sambuc 
6*0a6a1f1dSLionel Sambuc // returned somewhere in TLS wrapper:
7*0a6a1f1dSLionel Sambuc // CHECK: ret{{.*}}[[X_GLOBAL]]
8*0a6a1f1dSLionel Sambuc 
9*0a6a1f1dSLionel Sambuc template <typename T> class unique_ptr {
10*0a6a1f1dSLionel Sambuc   template <typename F, typename S> struct pair {
11*0a6a1f1dSLionel Sambuc     F first;
12*0a6a1f1dSLionel Sambuc     S second;
13*0a6a1f1dSLionel Sambuc   };
14*0a6a1f1dSLionel Sambuc   pair<T *, int> data;
15*0a6a1f1dSLionel Sambuc public:
unique_ptr()16*0a6a1f1dSLionel Sambuc   constexpr unique_ptr() noexcept : data() {}
unique_ptr(T * p)17*0a6a1f1dSLionel Sambuc   explicit unique_ptr(T *p) noexcept : data() {}
18*0a6a1f1dSLionel Sambuc };
19*0a6a1f1dSLionel Sambuc 
20*0a6a1f1dSLionel Sambuc thread_local unique_ptr<int> x;
main()21*0a6a1f1dSLionel Sambuc int main() { x = unique_ptr<int>(new int(5)); }
22*0a6a1f1dSLionel Sambuc 
23