Louis Dionne | 8c98eeb | 2018-10-10 17:37:37 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s |
Louis Dionne | e6e8175 | 2018-10-10 15:32:29 +0000 | [diff] [blame] | 2 | |
| 3 | // PR39118 |
| 4 | // Make sure that attributes are properly applied to explicit template |
| 5 | // instantiations. |
| 6 | |
| 7 | #define HIDDEN __attribute__((__visibility__("hidden"))) |
| 8 | #define VISIBLE __attribute__((__visibility__("default"))) |
| 9 | |
| 10 | namespace ns HIDDEN { |
| 11 | struct A { }; |
| 12 | template <typename T> struct B { static A a; }; |
| 13 | template <typename T> A B<T>::a; |
| 14 | |
| 15 | // CHECK: @_ZN2ns1BIiE1aE = weak_odr global |
| 16 | // CHECK-NOT: hidden |
| 17 | template VISIBLE A B<int>::a; |
| 18 | } |
| 19 | |
| 20 | struct C { }; |
| 21 | template <typename T> struct D { static C c; }; |
| 22 | template <typename T> C D<T>::c; |
| 23 | |
| 24 | // CHECK-DAG: @_ZN1DIiE1cB3TAGE |
| 25 | template __attribute__((abi_tag("TAG"))) C D<int>::c; |