1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 // Test that explicit instantiations do not instantiate entities
4 // marked with the exclude_from_explicit_instantiation attribute.
6 #define EXCLUDE_FROM_EXPLICIT_INSTANTIATION __attribute__((exclude_from_explicit_instantiation))
10 EXCLUDE_FROM_EXPLICIT_INSTANTIATION
inline void non_static_member_function1();
12 EXCLUDE_FROM_EXPLICIT_INSTANTIATION
void non_static_member_function2();
14 EXCLUDE_FROM_EXPLICIT_INSTANTIATION
static inline void static_member_function1();
16 EXCLUDE_FROM_EXPLICIT_INSTANTIATION
static void static_member_function2();
18 EXCLUDE_FROM_EXPLICIT_INSTANTIATION
static int static_data_member
;
20 struct EXCLUDE_FROM_EXPLICIT_INSTANTIATION member_class1
{
21 static void non_static_member_function() { using Fail
= typename
T::fail
; }
24 struct member_class2
{
25 EXCLUDE_FROM_EXPLICIT_INSTANTIATION
static void non_static_member_function() { using Fail
= typename
T::fail
; }
30 inline void Foo
<T
>::non_static_member_function1() { using Fail
= typename
T::fail
; }
33 void Foo
<T
>::non_static_member_function2() { using Fail
= typename
T::fail
; }
36 inline void Foo
<T
>::static_member_function1() { using Fail
= typename
T::fail
; }
39 void Foo
<T
>::static_member_function2() { using Fail
= typename
T::fail
; }
42 int Foo
<T
>::static_data_member
= T::fail
;
44 // expected-no-diagnostics
45 template struct Foo
<int>;