@@ -13,10 +13,11 @@ struct C {
1313 // inherits dllimport from the class instantiation.
1414 void to_be_imported () noexcept ;
1515
16- // Per-member dllimport in explicitly dllimport-ed template instantiation is not allowed.
17- // EXCLUDE_FROM_EXPLICIT_INSTANTIATION __declspec(dllimport) void to_be_imported_explicitly() noexcept;
16+ // This will be instantiated implicitly as an imported function because it is
17+ // marked as dllimport explicitly.
18+ EXCLUDE_FROM_EXPLICIT_INSTANTIATION __declspec (dllimport) void to_be_imported_explicitly () noexcept ;
1819
19- // This will be instantiated implicitly as an imported function unintentionally .
20+ // This will be instantiated implicitly but won't be imported .
2021 EXCLUDE_FROM_EXPLICIT_INSTANTIATION void not_to_be_imported () noexcept ;
2122
2223 // This won't be instantiated.
@@ -27,6 +28,8 @@ template <class T> void C<T>::to_be_imported() noexcept {}
2728template <class T > void C<T>::not_to_be_imported() noexcept {}
2829template <class T > void C<T>::not_to_be_instantiated() noexcept {}
2930
31+ // MSC: $"?not_to_be_imported@?$C@H@@QEAAXXZ" = comdat any
32+ // GNU: $_ZN1CIiE18not_to_be_importedEv = comdat any
3033extern template struct __declspec (dllimport) C<int >;
3134
3235void use () {
@@ -36,7 +39,9 @@ void use() {
3639 // GNU: call void @_ZN1CIiE14to_be_importedEv
3740 c.to_be_imported ();
3841
39- // c.to_be_imported_explicitly();
42+ // MSC: call void @"?to_be_imported_explicitly@?$C@H@@QEAAXXZ"
43+ // GNU: call void @_ZN1CIiE25to_be_imported_explicitlyEv
44+ c.to_be_imported_explicitly (); // implicitly instantiated here
4045
4146 // MSC: call void @"?not_to_be_imported@?$C@H@@QEAAXXZ"
4247 // GNU: call void @_ZN1CIiE18not_to_be_importedEv
@@ -46,5 +51,8 @@ void use() {
4651// MSC: declare dllimport void @"?to_be_imported@?$C@H@@QEAAXXZ"
4752// GNU: declare dllimport void @_ZN1CIiE14to_be_importedEv
4853
49- // MSC: declare dllimport void @"?not_to_be_imported@?$C@H@@QEAAXXZ"
50- // GNU: declare dllimport void @_ZN1CIiE18not_to_be_importedEv
54+ // MSC: declare dllimport void @"?to_be_imported_explicitly@?$C@H@@QEAAXXZ"
55+ // GNU: declare dllimport void @_ZN1CIiE25to_be_imported_explicitlyEv
56+
57+ // MSC: define linkonce_odr dso_local void @"?not_to_be_imported@?$C@H@@QEAAXXZ"
58+ // GNU: define linkonce_odr dso_local void @_ZN1CIiE18not_to_be_importedEv
0 commit comments