| 1 |
// RUN: %clang_cc1 -fptrauth-intrinsics -fsyntax-only -ferror-limit 1 -verify -std=c++26 %s |
| 2 |
// RUN: %clang_cc1 -fptrauth-intrinsics -fsyntax-only -ferror-limit 1 -verify -std=c++03 %s |
| 3 |
// RUN: %clang_cc1 -fsyntax-only -ferror-limit 1 -verify -std=c++03 %s |
| 4 |
|
| 5 |
/// Force two errors so we hit the error limit leading to skip of template instantiation |
| 6 |
# "" // expected-error {{invalid preprocessing directive}} |
| 7 |
# "" |
| 8 |
// expected-error@* {{too many errors emitted}} |
| 9 |
|
| 10 |
template <typename> |
| 11 |
struct a {}; |
| 12 |
struct test_polymorphic { |
| 13 |
virtual ~test_polymorphic(); |
| 14 |
a<int> field; |
| 15 |
}; |
| 16 |
static_assert(__is_trivially_relocatable(test_polymorphic)); |
| 17 |
|
| 18 |
struct test_struct { |
| 19 |
test_struct(int) {} |
| 20 |
void test_instantiate() { |
| 21 |
test_struct d(0); |
| 22 |
} |
| 23 |
void test_type_trait_query() { |
| 24 |
__is_trivially_relocatable(test_struct); |
| 25 |
} |
| 26 |
a<int> e; |
| 27 |
}; |
| 28 |
|
| 29 |
struct test_struct2 { |
| 30 |
test_struct member; |
| 31 |
void test() { |
| 32 |
test_struct2 t{.member = {0}}; |
| 33 |
} |
| 34 |
}; |
| 35 |
|
| 36 |
struct test_subclass : test_struct { |
| 37 |
test_subclass() : test_struct(0) { |
| 38 |
} |
| 39 |
|
| 40 |
void test_subclass_instantiation() { |
| 41 |
test_subclass subclass{}; |
| 42 |
} |
| 43 |
void test_subclass_type_trait_query() { |
| 44 |
__is_trivially_relocatable(test_subclass); |
| 45 |
} |
| 46 |
}; |