| 1 |
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s |
| 2 |
|
| 3 |
// Check that PR17480 is fixed: __attribute__((used)) ignored in templated |
| 4 |
// classes |
| 5 |
namespace InstantiateUsedMemberDefinition { |
| 6 |
template <typename T> |
| 7 |
struct S { |
| 8 |
int __attribute__((used)) f() { |
| 9 |
return 0; |
| 10 |
} |
| 11 |
}; |
| 12 |
|
| 13 |
void test() { |
| 14 |
// Check that InstantiateUsedMemberDefinition::S<int>::f() is defined |
| 15 |
// as a result of the S class template implicit instantiation |
| 16 |
// CHECK: define linkonce_odr noundef i32 @_ZN31InstantiateUsedMemberDefinition1SIiE1fEv |
| 17 |
S<int> inst; |
| 18 |
} |
| 19 |
} // namespace InstantiateUsedMemberDefinition |