brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 379ab0a Raw
46 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2 3// Test that explicit instantiations do not instantiate entities4// marked with the exclude_from_explicit_instantiation attribute.5 6#define EXCLUDE_FROM_EXPLICIT_INSTANTIATION __attribute__((exclude_from_explicit_instantiation))7 8template <class T>9struct Foo {10  EXCLUDE_FROM_EXPLICIT_INSTANTIATION inline void non_static_member_function1();11 12  EXCLUDE_FROM_EXPLICIT_INSTANTIATION void non_static_member_function2();13 14  EXCLUDE_FROM_EXPLICIT_INSTANTIATION static inline void static_member_function1();15 16  EXCLUDE_FROM_EXPLICIT_INSTANTIATION static void static_member_function2();17 18  EXCLUDE_FROM_EXPLICIT_INSTANTIATION static int static_data_member;19 20  struct EXCLUDE_FROM_EXPLICIT_INSTANTIATION member_class1 {21    static void non_static_member_function() { using Fail = typename T::fail; }22  };23 24  struct member_class2 {25    EXCLUDE_FROM_EXPLICIT_INSTANTIATION static void non_static_member_function() { using Fail = typename T::fail; }26  };27};28 29template <class T>30inline void Foo<T>::non_static_member_function1() { using Fail = typename T::fail; }31 32template <class T>33void Foo<T>::non_static_member_function2() { using Fail = typename T::fail; }34 35template <class T>36inline void Foo<T>::static_member_function1() { using Fail = typename T::fail; }37 38template <class T>39void Foo<T>::static_member_function2() { using Fail = typename T::fail; }40 41template <class T>42int Foo<T>::static_data_member = T::fail;43 44// expected-no-diagnostics45template struct Foo<int>;46