@@ -594,7 +594,8 @@ USEMEMFUNC(PartiallySpecializedExportedClassTemplate<void*>, f);
594
594
595
595
// MS ignores DLL attributes on partial specializations; inheritance still works though.
596
596
template <typename T> struct __declspec (dllexport) PartiallySpecializedExportedClassTemplate2 {};
597
- template <typename T> struct __declspec (dllimport) PartiallySpecializedExportedClassTemplate2<T*> { void f () {} };
597
+ template <typename T> struct __declspec (dllimport) PartiallySpecializedExportedClassTemplate2<T*> { void f (); };
598
+ template <typename T> void PartiallySpecializedExportedClassTemplate2<T*>::f() {}
598
599
USEMEMFUNC (PartiallySpecializedExportedClassTemplate2<void *>, f);
599
600
// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01?f@?$PartiallySpecializedExportedClassTemplate2@PAX@@QAEXXZ"
600
601
// G32-DAG: declare dllimport x86_thiscallcc void @_ZN42PartiallySpecializedExportedClassTemplate2IPvE1fEv
@@ -621,20 +622,21 @@ struct __declspec(dllexport) ExportedDerivedClass : NonExportedBaseClass {};
621
622
622
623
template <typename T> struct ClassTemplate { void func () {} };
623
624
template <typename T> struct __declspec (dllexport) ExportedClassTemplate { void func () {} };
624
- template <typename T> struct __declspec (dllimport) ImportedClassTemplate { void func () {} };
625
+ template <typename T> struct __declspec (dllimport) ImportedClassTemplate { void func (); };
626
+ template <typename T> void ImportedClassTemplate<T>::func() {}
625
627
626
628
template <typename T> struct ExplicitlySpecializedTemplate { void func () {} };
627
629
template <> struct ExplicitlySpecializedTemplate <int > { void func () {} };
628
630
template <typename T> struct ExplicitlyExportSpecializedTemplate { void func () {} };
629
631
template <> struct __declspec (dllexport) ExplicitlyExportSpecializedTemplate<int > { void func () {} };
630
- template <typename T> struct ExplicitlyImportSpecializedTemplate { void func () {} };
631
- template <> struct __declspec (dllimport) ExplicitlyImportSpecializedTemplate<int > { void func () {} };
632
+ template <typename T> struct ExplicitlyImportSpecializedTemplate { void func (); };
633
+ template <> struct __declspec (dllimport) ExplicitlyImportSpecializedTemplate<int > { void func (); };
632
634
633
635
template <typename T> struct ExplicitlyInstantiatedTemplate { void func () {} };
634
636
template struct ExplicitlyInstantiatedTemplate <int >;
635
637
template <typename T> struct ExplicitlyExportInstantiatedTemplate { void func () {} };
636
638
template struct __declspec (dllexport) ExplicitlyExportInstantiatedTemplate<int >;
637
- template <typename T> struct ExplicitlyImportInstantiatedTemplate { void func () {} };
639
+ template <typename T> struct ExplicitlyImportInstantiatedTemplate { void func (); };
638
640
template struct __declspec (dllimport) ExplicitlyImportInstantiatedTemplate<int >;
639
641
640
642
@@ -685,8 +687,8 @@ USEMEMFUNC(DerivedFromExplicitlyExportSpecializedTemplate, func)
685
687
// Base class already specialized with import attribute.
686
688
struct __declspec(dllexport) DerivedFromExplicitlyImportSpecializedTemplate : public ExplicitlyImportSpecializedTemplate<int> {};
687
689
USEMEMFUNC (DerivedFromExplicitlyImportSpecializedTemplate, func)
688
- // M32-DAG: {{ declare|define available_externally}} dllimport x86_thiscallcc void @"\01?func@?$ExplicitlyImportSpecializedTemplate@H@@QAEXXZ"
689
- // G32-DAG: {{ declare|define available_externally}} dllimport x86_thiscallcc void @_ZN35ExplicitlyImportSpecializedTemplateIiE4funcEv
690
+ // M32-DAG: declare dllimport x86_thiscallcc void @"\01?func@?$ExplicitlyImportSpecializedTemplate@H@@QAEXXZ"
691
+ // G32-DAG: declare dllimport x86_thiscallcc void @_ZN35ExplicitlyImportSpecializedTemplateIiE4funcEv
690
692
691
693
// Base class already instantiated without dll attribute.
692
694
struct __declspec(dllexport) DerivedFromExplicitlyInstantiatedTemplate : public ExplicitlyInstantiatedTemplate<int> {};
@@ -703,8 +705,8 @@ USEMEMFUNC(DerivedFromExplicitlyExportInstantiatedTemplate, func)
703
705
// Base class already instantiated with import attribute.
704
706
struct __declspec(dllexport) DerivedFromExplicitlyImportInstantiatedTemplate : public ExplicitlyImportInstantiatedTemplate<int> {};
705
707
USEMEMFUNC (DerivedFromExplicitlyImportInstantiatedTemplate, func)
706
- // M32-DAG: {{ declare|define available_externally}} dllimport x86_thiscallcc void @"\01?func@?$ExplicitlyImportInstantiatedTemplate@H@@QAEXXZ"
707
- // G32-DAG: {{ declare|define available_externally}} dllimport x86_thiscallcc void @_ZN36ExplicitlyImportInstantiatedTemplateIiE4funcEv
708
+ // M32-DAG: declare dllimport x86_thiscallcc void @"\01?func@?$ExplicitlyImportInstantiatedTemplate@H@@QAEXXZ"
709
+ // G32-DAG: declare dllimport x86_thiscallcc void @_ZN36ExplicitlyImportInstantiatedTemplateIiE4funcEv
708
710
709
711
// MS: A dll attribute propagates through multiple levels of instantiation.
710
712
template <typename T> struct TopClass { void func () {} };
0 commit comments