1 // RUN: %clang_cc1 -fsyntax-only -Wundefined-func-template -Wundefined-var-template -verify %s
3 // Test that a diagnostic is emitted when an entity marked with the
4 // exclude_from_explicit_instantiation attribute is not defined in
5 // the current TU but it is used (and it is hence implicitly
8 #define EXCLUDE_FROM_EXPLICIT_INSTANTIATION __attribute__((exclude_from_explicit_instantiation))
12 EXCLUDE_FROM_EXPLICIT_INSTANTIATION
void non_static_member_function(); // expected-note{{forward declaration of template entity is here}}
13 EXCLUDE_FROM_EXPLICIT_INSTANTIATION
static void static_member_function(); // expected-note{{forward declaration of template entity is here}}
14 EXCLUDE_FROM_EXPLICIT_INSTANTIATION
static int static_data_member
; // expected-note{{forward declaration of template entity is here}}
15 struct EXCLUDE_FROM_EXPLICIT_INSTANTIATION nested
{
16 static int static_member_function(); // expected-note{{forward declaration of template entity is here}}
20 extern template struct Foo
<int>;
25 foo
.non_static_member_function(); // expected-warning{{instantiation of function 'Foo<int>::non_static_member_function' required here, but no definition is available}}
26 // expected-note@-1 {{add an explicit instantiation}}
28 Foo
<int>::static_member_function(); // expected-warning{{instantiation of function 'Foo<int>::static_member_function' required here, but no definition is available}}
29 // expected-note@-1 {{add an explicit instantiation}}
31 (void)Foo
<int>::static_data_member
; // expected-warning{{instantiation of variable 'Foo<int>::static_data_member' required here, but no definition is available}}
32 // expected-note@-1 {{add an explicit instantiation}}
34 Foo
<int>::nested::static_member_function(); // expected-warning{{instantiation of function 'Foo<int>::nested::static_member_function' required here, but no definition is available}}
35 // expected-note@-1 {{add an explicit instantiation}}