1 // RUN: %clang_cc1 -Wno-unused-local-typedef -fsyntax-only -verify %s
3 // Test that extern instantiation declarations cause members marked with
4 // the exclude_from_explicit_instantiation attribute to be instantiated in
7 #define EXCLUDE_FROM_EXPLICIT_INSTANTIATION __attribute__((exclude_from_explicit_instantiation))
11 EXCLUDE_FROM_EXPLICIT_INSTANTIATION
inline void non_static_member_function1();
13 EXCLUDE_FROM_EXPLICIT_INSTANTIATION
void non_static_member_function2();
15 EXCLUDE_FROM_EXPLICIT_INSTANTIATION
static inline void static_member_function1();
17 EXCLUDE_FROM_EXPLICIT_INSTANTIATION
static void static_member_function2();
19 EXCLUDE_FROM_EXPLICIT_INSTANTIATION
static int static_data_member
;
21 struct EXCLUDE_FROM_EXPLICIT_INSTANTIATION member_class1
{
22 static void static_member_function() {
23 using Fail
= typename
T::invalid
; // expected-error{{no type named 'invalid' in 'Empty'}}
27 struct member_class2
{
28 EXCLUDE_FROM_EXPLICIT_INSTANTIATION
static void static_member_function() {
29 using Fail
= typename
T::invalid
; // expected-error{{no type named 'invalid' in 'Empty'}}
35 inline void Foo
<T
>::non_static_member_function1() {
36 using Fail
= typename
T::invalid
; // expected-error{{no type named 'invalid' in 'Empty'}}
40 void Foo
<T
>::non_static_member_function2() {
41 using Fail
= typename
T::invalid
; // expected-error{{no type named 'invalid' in 'Empty'}}
45 inline void Foo
<T
>::static_member_function1() {
46 using Fail
= typename
T::invalid
; // expected-error{{no type named 'invalid' in 'Empty'}}
50 void Foo
<T
>::static_member_function2() {
51 using Fail
= typename
T::invalid
; // expected-error{{no type named 'invalid' in 'Empty'}}
55 int Foo
<T
>::static_data_member
= T::invalid
; // expected-error{{no member named 'invalid' in 'Empty'}}
58 extern template struct Foo
<Empty
>;
62 foo
.non_static_member_function1(); // expected-note{{in instantiation of}}
63 foo
.non_static_member_function2(); // expected-note{{in instantiation of}}
64 Foo
<Empty
>::static_member_function1(); // expected-note{{in instantiation of}}
65 Foo
<Empty
>::static_member_function2(); // expected-note{{in instantiation of}}
66 (void)foo
.static_data_member
; // expected-note{{in instantiation of}}
67 Foo
<Empty
>::member_class1::static_member_function(); // expected-note{{in instantiation of}}
68 Foo
<Empty
>::member_class2::static_member_function(); // expected-note{{in instantiation of}}