47 lines · cpp
1// RUN: %clang_cc1 -fptrauth-intrinsics -fsyntax-only -ferror-limit 1 -verify -std=c++26 %s2// RUN: %clang_cc1 -fptrauth-intrinsics -fsyntax-only -ferror-limit 1 -verify -std=c++03 %s3// RUN: %clang_cc1 -fsyntax-only -ferror-limit 1 -verify -std=c++03 %s4 5/// Force two errors so we hit the error limit leading to skip of template instantiation6# "" // expected-error {{invalid preprocessing directive}}7# ""8// expected-error@* {{too many errors emitted}}9 10template <typename>11struct a {};12struct test_polymorphic {13 virtual ~test_polymorphic();14 a<int> field;15};16static_assert(__is_trivially_relocatable(test_polymorphic));17 18struct 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 29struct test_struct2 {30 test_struct member;31 void test() {32 test_struct2 t{.member = {0}};33 }34};35 36struct 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};47