Home | History | Annotate | Download | only in SemaCXX

Lines Matching full:template

1 // RUN: %clang_cc1 -triple i686-win32     -fsyntax-only -fms-extensions -verify -std=c++11 -Wunsupported-dll-base-class-template -DMS %s
2 // RUN: %clang_cc1 -triple x86_64-win32 -fsyntax-only -fms-extensions -verify -std=c++1y -Wunsupported-dll-base-class-template -DMS %s
3 // RUN: %clang_cc1 -triple i686-mingw32 -fsyntax-only -fms-extensions -verify -std=c++1y -Wunsupported-dll-base-class-template -DGNU %s
4 // RUN: %clang_cc1 -triple x86_64-mingw32 -fsyntax-only -fms-extensions -verify -std=c++11 -Wunsupported-dll-base-class-template -DGNU %s
127 template<typename T> __declspec(dllimport) extern int ExternVarTmplDecl;
130 template<typename T> __declspec(dllimport) int VarTmplDecl;
133 template<typename T> __declspec(dllimport) extern int ExternVarTmplInit = 1; // expected-error{{definition of dllimport data}}
134 template<typename T> __declspec(dllimport) int VarTmplInit1 = 1; // expected-error{{definition of dllimport data}}
135 template<typename T> int __declspec(dllimport) VarTmplInit2 = 1; // expected-error{{definition of dllimport data}}
138 template<typename T> __declspec(dllimport) extern int ExternVarTmplDeclInit; // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
139 template<typename T> int ExternVarTmplDeclInit = 1; // expected-warning{{'ExternVarTmplDeclInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
141 template<typename T> __declspec(dllimport) int VarTmplDeclInit; // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
142 template<typename T> int VarTmplDeclInit = 1; // expected-warning{{'VarTmplDeclInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
145 template<typename T> __declspec(dllimport) extern int VarTmplRedecl1;
146 template<typename T> __declspec(dllimport) extern int VarTmplRedecl1;
148 template<typename T> __declspec(dllimport) int VarTmplRedecl2;
149 template<typename T> __declspec(dllimport) int VarTmplRedecl2;
151 template<typename T> __declspec(dllimport) extern int VarTmplRedecl3; // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
152 template<typename T> extern int VarTmplRedecl3; // expected-warning{{'VarTmplRedecl3' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
154 template<typename T> extern int VarTmplRedecl4; // expected-note{{previous declaration is here}}
155 template<typename T> __declspec(dllimport) extern int VarTmplRedecl4; // expected-error{{redeclaration of 'VarTmplRedecl4' cannot add 'dllimport' attribute}}
158 template<typename T> __declspec(dllimport) static int StaticVarTmpl; // expected-error{{'StaticVarTmpl' must have external linkage when declared 'dllimport'}}
159 template<typename T> __declspec(dllimport) Internal InternalTypeVarTmpl; // expected-error{{'InternalTypeVarTmpl' must have external linkage when declared 'dllimport'}}
160 namespace { template<typename T> __declspec(dllimport) int InternalVarTmpl; } // expected-error{{'(anonymous namespace)::InternalVarTmpl' must have external linkage when declared 'dllimport'}}
161 namespace ns { template<typename T> __declspec(dllimport) int ExternalVarTmpl; }
163 template<typename T> __declspec(dllimport) auto InternalAutoTypeVarTmpl = Internal(); // expected-error{{definition of dllimport data}} // expected-error{{'InternalAutoTypeVarTmpl' must have external linkage when declared 'dllimport'}}
166 template<typename T> int VarTmpl;
167 template<typename T> __declspec(dllimport) int ImportedVarTmpl;
169 // Import implicit instantiation of an imported variable template.
172 // Import explicit instantiation declaration of an imported variable template.
173 extern template int ImportedVarTmpl<ExplicitDecl_Imported>;
175 // An explicit instantiation definition of an imported variable template cannot
176 // be imported because the template must be defined which is illegal.
178 // Import specialization of an imported variable template.
179 template<> __declspec(dllimport) int ImportedVarTmpl<ExplicitSpec_Imported>;
180 template<> __declspec(dllimport) int ImportedVarTmpl<ExplicitSpec_Def_Imported> = 1; // expected-error{{definition of dllimport data}}
182 // Not importing specialization of an imported variable template without
184 template<> int ImportedVarTmpl<ExplicitSpec_NotImported>;
187 // Import explicit instantiation declaration of a non-imported variable template.
188 extern template __declspec(dllimport) int VarTmpl<ExplicitDecl_Imported>;
190 // Import explicit instantiation definition of a non-imported variable template.
191 template __declspec(dllimport) int VarTmpl<ExplicitInst_Imported>;
193 // Import specialization of a non-imported variable template.
194 template<> __declspec(dllimport) int VarTmpl<ExplicitSpec_Imported>;
195 template<> __declspec(dllimport) int VarTmpl<ExplicitSpec_Def_Imported> = 1; // expected-error{{definition of dllimport data}}
320 // Import function template declaration. Check different placements.
321 template<typename T> __declspec(dllimport) void funcTmplDecl1();
322 template<typename T> void __declspec(dllimport) funcTmplDecl2();
324 // Import function template definition.
325 template<typename T> __declspec(dllimport) void funcTmplDef() {} // expected-error{{dllimport cannot be applied to non-inline function definition}}
327 // Import inline function template.
334 template<typename T> __declspec(dllimport) inline void inlineFuncTmpl1() {}
335 template<typename T> inline void __attribute__((dllimport)) inlineFuncTmpl2() {}
337 template<typename T> __declspec(dllimport) inline void inlineFuncTmplDecl();
338 template<typename T> void inlineFuncTmplDecl() {}
340 template<typename T> __declspec(dllimport) void inlineFuncTmplDef();
341 template<typename T> inline void inlineFuncTmplDef() {}
344 template<typename T> __declspec(dllimport) void funcTmplRedecl1();
345 template<typename T> __declspec(dllimport) void funcTmplRedecl1();
347 template<typename T> __declspec(dllimport) void funcTmplRedecl2(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
348 template<typename T> void funcTmplRedecl2(); // expected-warning{{'funcTmplRedecl2' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
350 template<typename T> __declspec(dllimport) void funcTmplRedecl3(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
351 template<typename T> void funcTmplRedecl3() {} // expected-warning{{'funcTmplRedecl3' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
353 template<typename T> void funcTmplRedecl4(); // expected-note{{previous declaration is here}}
354 template<typename T> __declspec(dllimport) void funcTmplRedecl4(); // expected-error{{redeclaration of 'funcTmplRedecl4' cannot add 'dllimport' attribute}}
357 template<typename T> void funcTmplRedecl5(); // expected-note{{previous declaration is here}}
358 template<typename T> __declspec(dllimport) inline void funcTmplRedecl5() {} // expected-error{{redeclaration of 'funcTmplRedecl5' cannot add 'dllimport' attribute}}
361 // Function template friends
363 template<typename T> friend __declspec(dllimport) void funcTmplFriend1();
364 template<typename T> friend __declspec(dllimport) void funcTmplFriend2(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
365 template<typename T> friend __declspec(dllimport) void funcTmplFriend3(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
366 template<typename T> friend void funcTmplFriend4(); // expected-note{{previous declaration is here}}
370 template<typename T> friend __declspec(dllimport) inline void funcTmplFriend5();
372 template<typename T> __declspec(dllimport) void funcTmplFriend1();
373 template<typename T> void funcTmplFriend2(); // expected-warning{{'funcTmplFriend2' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
374 template<typename T> void funcTmplFriend3() {} // expected-warning{{'funcTmplFriend3' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
375 template<typename T> __declspec(dllimport) void funcTmplFriend4(); // expected-error{{redeclaration of 'funcTmplFriend4' cannot add 'dllimport' attribute}}
376 template<typename T> inline void funcTmplFriend5() {}
379 template<typename T> __declspec(dllimport) static int staticFuncTmpl(); // expected-error{{'staticFuncTmpl' must have external linkage when declared 'dllimport'}}
380 template<typename T> __declspec(dllimport) Internal internalRetFuncTmpl(); // expected-error{{'internalRetFuncTmpl' must have external linkage when declared 'dllimport'}}
381 namespace { template<typename T> __declspec(dllimport) void internalFuncTmpl(); } // expected-error{{'(anonymous namespace)::internalFuncTmpl' must have external linkage when declared 'dllimport'}}
382 namespace ns { template<typename T> __declspec(dllimport) void externalFuncTmpl(); }
385 template<typename T> void funcTmpl() {}
386 template<typename T> inline void inlineFuncTmpl() {}
387 template<typename T> __declspec(dllimport) void importedFuncTmplDecl();
391 template<typename T> __declspec(dllimport) inline void importedFuncTmpl() {}
393 // Import implicit instantiation of an imported function template.
397 // Import explicit instantiation declaration of an imported function template.
398 extern template void importedFuncTmpl<ExplicitDecl_Imported>();
400 // Import explicit instantiation definition of an imported function template.
403 template void importedFuncTmpl<ExplicitInst_Imported>();
405 // Import specialization of an imported function template. A definition must be
407 template<> __declspec(dllimport) void importedFuncTmpl<ExplicitSpec_Imported>();
408 template<> __declspec(dllimport) void importedFuncTmpl<ExplicitSpec_Def_Imported>() {} // expected-error{{dllimport cannot be applied to non-inline function definition}}
410 template<> __declspec(dllimport) inline void importedFuncTmpl<ExplicitSpec_InlineDef_Imported>() {}
413 // Not importing specialization of an imported function template without
415 template<> void importedFuncTmpl<ExplicitSpec_NotImported>() {}
418 // Import explicit instantiation declaration of a non-imported function template.
419 extern template __declspec(dllimport) void funcTmpl<ExplicitDecl_Imported>();
423 extern template __declspec(dllimport) void inlineFuncTmpl<ExplicitDecl_Imported>();
425 // Import explicit instantiation definition of a non-imported function template.
426 template __declspec(dllimport) void funcTmpl<ExplicitInst_Imported>();
430 template __declspec(dllimport) void inlineFuncTmpl<ExplicitInst_Imported>();
432 // Import specialization of a non-imported function template. A definition must
434 template<> __declspec(dllimport) void funcTmpl<ExplicitSpec_Imported>();
435 template<> __declspec(dllimport) void funcTmpl<ExplicitSpec_Def_Imported>() {} // expected-error{{dllimport cannot be applied to non-inline function definition}}
439 template<> __declspec(dllimport) inline void funcTmpl<ExplicitSpec_InlineDef_Imported>() {}
716 template<typename T> __declspec(dllimport) void normalDecl();
717 template<typename T> __declspec(dllimport) void normalDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
718 template<typename T> __declspec(dllimport) void normalInlineDef();
719 template<typename T> __declspec(dllimport) static void staticDecl();
720 template<typename T> __declspec(dllimport) static void staticDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
721 template<typename T> __declspec(dllimport) static void staticInlineDef();
729 template<typename T> __declspec(dllimport) void normalInclass() {}
730 template<typename T> __declspec(dllimport) inline void normalInlineDecl();
731 template<typename T> __declspec(dllimport) static void staticInclass() {}
732 template<typename T> __declspec(dllimport) static inline void staticInlineDecl();
735 template<typename T> __declspec(dllimport) static int StaticField;
736 template<typename T> __declspec(dllimport) static int StaticFieldDef; // expected-note{{attribute is here}}
737 template<typename T> __declspec(dllimport) static const int StaticConstField;
738 template<typename T> __declspec(dllimport) static const int StaticConstFieldDef; // expected-note{{attribute is here}}
739 template<typename T> __declspec(dllimport) static const int StaticConstFieldEqualInit = 1;
740 template<typename T> __declspec(dllimport) static const int StaticConstFieldBraceInit{1};
741 template<typename T> __declspec(dllimport) constexpr static int ConstexprField = 1;
742 template<typename T> __declspec(dllimport) constexpr static int ConstexprFieldDef = 1; // expected-note{{attribute is here}}
746 template<typename T> void ImportMemberTmpl::normalDef() {} // expected-warning{{'ImportMemberTmpl::normalDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
747 template<typename T> void ImportMemberTmpl::normalInlineDecl() {}
748 template<typename T> void ImportMemberTmpl::staticDef() {} // expected-warning{{'ImportMemberTmpl::staticDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
749 template<typename T> void ImportMemberTmpl::staticInlineDecl() {}
755 template<typename T> inline void ImportMemberTmpl::normalInlineDef() {}
756 template<typename T> inline void ImportMemberTmpl::staticInlineDef() {}
759 template<typename T> int ImportMemberTmpl::StaticFieldDef; // expected-error{{definition of dllimport static field not allowed}}
760 template<typename T> const int ImportMemberTmpl::StaticConstFieldDef = 1; // expected-error{{definition of dllimport static field not allowed}}
761 template<typename T> constexpr int ImportMemberTmpl::ConstexprFieldDef; // expected-error{{definition of dllimport static field not allowed}}
767 template<typename T> void normalDef(); // expected-note{{previous declaration is here}}
768 template<typename T> inline void normalInlineDecl(); // expected-note{{previous declaration is here}}
769 template<typename T> static void staticDef(); // expected-note{{previous declaration is here}}
770 template<typename T> static inline void staticInlineDecl(); // expected-note{{previous declaration is here}}
776 template<typename T> void normalInlineDef();
777 template<typename T> static void staticInlineDef();
780 template<typename T> static int StaticField; // expected-note{{previous declaration is here}}
781 template<typename T> static const int StaticConstField; // expected-note{{previous declaration is here}}
782 template<typename T> constexpr static int ConstexprField = 1; // expected-note{{previous declaration is here}}
786 template
789 template<typename T> __declspec(dllimport) inline void MemTmplRedecl::normalInlineDef() {} // expected-error{{redeclaration of 'MemTmplRedecl::normalInlineDef' cannot add 'dllimport' attribute}}
791 template<typename T> __declspec(dllimport) inline void MemTmplRedecl::normalInlineDef() {} // expected-warning{{'dllimport' attribute ignored on inline function}}
793 template<typename T> __declspec(dllimport) void MemTmplRedecl::normalInlineDecl() {} // expected-error{{redeclaration of 'MemTmplRedecl::normalInlineDecl' cannot add 'dllimport' attribute}}
794 template<typename T> __declspec(dllimport) void MemTmplRedecl::staticDef() {} // expected-error{{redeclaration of 'MemTmplRedecl::staticDef' cannot add 'dllimport' attribute}}
797 template<typename T> __declspec(dllimport) inline void MemTmplRedecl::staticInlineDef() {} // expected-error{{redeclaration of 'MemTmplRedecl::staticInlineDef' cannot add 'dllimport' attribute}}
799 template<typename T> __declspec(dllimport) inline void MemTmplRedecl::staticInlineDef() {} // expected-warning{{'dllimport' attribute ignored on inline function}}
801 template<typename T> __declspec(dllimport) void MemTmplRedecl::staticInlineDecl() {} // expected-error{{redeclaration of 'MemTmplRedecl::staticInlineDecl' cannot add 'dllimport' attribute}}
804 template<typename T> __declspec(dllimport) int MemTmplRedecl::StaticField = 1; // expected-error{{redeclaration of 'MemTmplRedecl::StaticField' cannot add 'dllimport' attribute}}
807 template<typename T> __declspec(dllimport) const int MemTmplRedecl::StaticConstField = 1; // expected-error{{redeclaration of 'MemTmplRedecl::StaticConstField' cannot add 'dllimport' attribute}}
810 template<typename T> __declspec(dllimport) constexpr int MemTmplRedecl::ConstexprField; // expected-error{{redeclaration of 'MemTmplRedecl::ConstexprField' cannot add 'dllimport' attribute}}
818 template<typename T> void normalDef() {}
822 template<typename T> __declspec(dllimport) void importedNormal() {}
823 template<typename T> static void staticDef() {}
827 template<typename T> __declspec(dllimport) static void importedStatic() {}
830 // Import implicit instantiation of an imported member function template.
837 // template.
838 extern template void MemFunTmpl::importedNormal<ExplicitDecl_Imported>();
839 extern template void MemFunTmpl::importedStatic<ExplicitDecl_Imported>();
842 // template.
844 template void MemFunTmpl::importedNormal<ExplicitInst_Imported>();
845 template void MemFunTmpl::importedStatic<ExplicitInst_Imported>();
847 // Import specialization of an imported member function template.
848 template<> __declspec(dllimport) void MemFunTmpl::importedNormal<ExplicitSpec_Imported>();
849 template<> __declspec(dllimport) void MemFunTmpl::importedNormal<ExplicitSpec_Def_Imported>() {} // error on mingw
853 template<> __declspec(dllimport) inline void MemFunTmpl::importedNormal<ExplicitSpec_InlineDef_Imported>() {}
859 template<> __declspec(dllimport) void MemFunTmpl::importedStatic<ExplicitSpec_Imported>();
860 template<> __declspec(dllimport) void MemFunTmpl::importedStatic<ExplicitSpec_Def_Imported>() {} // error on mingw
864 template<> __declspec(dllimport) inline void MemFunTmpl::importedStatic<ExplicitSpec_InlineDef_Imported>() {}
870 // Not importing specialization of an imported member function template without
872 template<> void MemFunTmpl::importedNormal<ExplicitSpec_NotImported>() {}
873 template<> void MemFunTmpl::importedStatic<ExplicitSpec_NotImported>() {}
877 // template.
882 extern template __declspec(dllimport) void MemFunTmpl::normalDef<ExplicitDecl_Imported>();
883 extern template __declspec(dllimport) void MemFunTmpl::staticDef<ExplicitDecl_Imported>();
886 // template.
891 template __declspec(dllimport) void MemFunTmpl::normalDef<ExplicitInst_Imported>();
892 template __declspec(dllimport) void MemFunTmpl::staticDef<ExplicitInst_Imported>();
894 // Import specialization of a non-imported member function template.
895 template<> __declspec(dllimport) void MemFunTmpl::normalDef<ExplicitSpec_Imported>();
896 template<> __declspec(dllimport) void MemFunTmpl::normalDef<ExplicitSpec_Def_Imported>() {} // error on mingw
900 template<> __declspec(dllimport) inline void MemFunTmpl::normalDef<ExplicitSpec_InlineDef_Imported>() {}
906 template<> __declspec(dllimport) void MemFunTmpl::staticDef<ExplicitSpec_Imported>();
907 template<> __declspec(dllimport) void MemFunTmpl::staticDef<ExplicitSpec_Def_Imported>() {} // error on mingw
911 template<> __declspec(dllimport) inline void MemFunTmpl::staticDef<ExplicitSpec_InlineDef_Imported>() {}
921 template<typename T> static const int StaticVar = 1;
922 template<typename T> __declspec(dllimport) static const int ImportedStaticVar = 1;
925 // Import implicit instantiation of an imported member variable template.
929 // template.
930 extern template const int MemVarTmpl::ImportedStaticVar<ExplicitDecl_Imported>;
932 // An explicit instantiation definition of an imported member variable template
933 // cannot be imported because the template must be defined which is illegal. The
936 // Import specialization of an imported member variable template.
937 template<> __declspec(dllimport) const int MemVarTmpl::ImportedStaticVar<ExplicitSpec_Imported>;
938 template<> __declspec(dllimport) const int MemVarTmpl::ImportedStaticVar<ExplicitSpec_Def_Imported> = 1;
942 // Not importing specialization of a member variable template without explicit
944 template<> const int MemVarTmpl::ImportedStaticVar<ExplicitSpec_NotImported>;
948 // template.
949 extern template __declspec(dllimport) const int MemVarTmpl::StaticVar<ExplicitDecl_Imported>;
951 // An explicit instantiation definition of a non-imported member variable template
952 // cannot be imported because the template must be defined which is illegal. The
955 // Import specialization of a non-imported member variable template.
956 template<> __declspec(dllimport) const int MemVarTmpl::StaticVar<ExplicitSpec_Imported>;
957 template<> __declspec(dllimport) const int MemVarTmpl::StaticVar<ExplicitSpec_Def_Imported> = 1;
966 // Class template members
969 // Import individual members of a class template.
970 template<typename T>
1016 template<typename T> void ImportClassTmplMembers<T>::normalDef() {} // expected-warning{{'ImportClassTmplMembers::normalDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
1020 template<typename T> inline void ImportClassTmplMembers<T>::normalInlineDef() {}
1021 template<typename T> void ImportClassTmplMembers<T>::normalInlineDecl() {}
1022 template<typename T> void ImportClassTmplMembers<T>::virtualDef() {} // expected-warning{{'ImportClassTmplMembers::virtualDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
1026 template<typename T> inline void ImportClassTmplMembers<T>::virtualInlineDef() {}
1027 template<typename T> void ImportClassTmplMembers<T>::virtualInlineDecl() {}
1028 template<typename T> void ImportClassTmplMembers<T>::staticDef() {} // expected-warning{{'ImportClassTmplMembers::staticDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
1032 template<typename T> inline void ImportClassTmplMembers<T>::staticInlineDef() {}
1033 template<typename T> void ImportClassTmplMembers<T>::staticInlineDecl() {}
1035 template<typename T> int ImportClassTmplMembers<T>::StaticFieldDef; // expected-warning{{definition of dllimport static field}}
1036 template<typename T> const int ImportClassTmplMembers<T>::StaticConstFieldDef = 1; // expected-warning{{definition of dllimport static field}}
1037 template<typename T> constexpr int ImportClassTmplMembers<T>::ConstexprFieldDef; // expected-warning{{definition of dllimport static field}}
1041 template<typename T>
1064 template<typename T> __declspec(dllimport) void CTMR<T>::normalDef() {} // expected-error{{redeclaration of 'CTMR::normalDef' cannot add 'dllimport' attribute}}
1066 template<typename T> __declspec(dllimport) void CTMR<T>::normalInlineDecl() {} // expected-error{{redeclaration of 'CTMR::normalInlineDecl' cannot add 'dllimport' attribute}}
1067 template<typename T> __declspec(dllimport) void CTMR<T>::virtualDef() {} // expected-error{{redeclaration of 'CTMR::virtualDef' cannot add 'dllimport' attribute}}
1069 template<typename T> __declspec(dllimport) void CTMR<T>::virtualInlineDecl() {} // expected-error{{redeclaration of 'CTMR::virtualInlineDecl' cannot add 'dllimport' attribute}}
1070 template<typename T> __declspec(dllimport) void CTMR<T>::staticDef() {} // expected-error{{redeclaration of 'CTMR::staticDef' cannot add 'dllimport' attribute}}
1072 template<typename T> __declspec(dllimport) void CTMR<T>::staticInlineDecl() {} // expected-error{{redeclaration of 'CTMR::staticInlineDecl' cannot add 'dllimport' attribute}}
1075 template<typename T> __declspec(dllimport) inline void CTMR<T>::normalInlineDef() {} // expected-error{{redeclaration of 'CTMR::normalInlineDef' cannot add 'dllimport' attribute}}
1076 template<typename T> __declspec(dllimport) inline void CTMR<T>::virtualInlineDef() {} // expected-error{{redeclaration of 'CTMR::virtualInlineDef' cannot add 'dllimport' attribute}}
1077 template<typename T> __declspec(dllimport) inline void CTMR<T>::staticInlineDef() {} // expected-error{{redeclaration of 'CTMR::staticInlineDef' cannot add 'dllimport' attribute}}
1079 template<typename T> __declspec(dllimport) inline void CTMR<T>::normalInlineDef() {} // expected-warning{{'dllimport' attribute ignored on inline function}}
1080 template<typename T> __declspec(dllimport) inline void CTMR<T>::virtualInlineDef() {} // expected-warning{{'dllimport' attribute ignored on inline function}}
1081 template<typename T> __declspec(dllimport) inline void CTMR<T>::staticInlineDef() {} // expected-warning{{'dllimport' attribute ignored on inline function}}
1084 template<typename T> __declspec(dllimport) int CTMR<T>::StaticField = 1; // expected-error{{redeclaration of 'CTMR::StaticField' cannot add 'dllimport' attribute}}
1087 template<typename T> __declspec(dllimport) const int CTMR<T>::StaticConstField = 1; // expected-error{{redeclaration of 'CTMR::StaticConstField' cannot add 'dllimport' attribute}}
1090 template<typename T> __declspec(dllimport) constexpr int CTMR<T>::ConstexprField; // expected-error{{redeclaration of 'CTMR::ConstexprField' cannot add 'dllimport' attribute}}
1097 // Class template member templates
1100 template<typename T>
1102 template<typename U> __declspec(dllimport) void normalDecl();
1103 template<typename U> __declspec(dllimport) void normalDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
1104 template<typename U> __declspec(dllimport) void normalInlineDef();
1105 template<typename U> __declspec(dllimport) static void staticDecl();
1106 template<typename U> __declspec(dllimport) static void staticDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
1107 template<typename U> __declspec(dllimport) static void staticInlineDef();
1115 template<typename U> __declspec(dllimport) void normalInclass() {}
1116 template<typename U> __declspec(dllimport) inline void normalInlineDecl();
1117 template<typename U> __declspec(dllimport) static void staticInclass() {}
1118 template<typename U> __declspec(dllimport) static inline void staticInlineDecl();
1121 template<typename U> __declspec(dllimport) static int StaticField;
1122 template<typename U> __declspec(dllimport) static int StaticFieldDef; // expected-note{{attribute is here}}
1123 template<typename U> __declspec(dllimport) static const int StaticConstField;
1124 template<typename U> __declspec(dllimport) static const int StaticConstFieldDef; // expected-note{{attribute is here}}
1125 template<typename U> __declspec(dllimport) static const int StaticConstFieldEqualInit = 1;
1126 template<typename U> __declspec(dllimport) static const int StaticConstFieldBraceInit{1};
1127 template<typename U> __declspec(dllimport) constexpr static int ConstexprField = 1;
1128 template<typename U> __declspec(dllimport) constexpr static int ConstexprFieldDef = 1; // expected-note{{attribute is here}}
1132 template<typename T> template<typename U> void ImportClsTmplMemTmpl<T>::normalDef() {} // expected-warning{{'ImportClsTmplMemTmpl::normalDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
1133 template<typename T> template<typename U> void ImportClsTmplMemTmpl<T>::normalInlineDecl() {}
1134 template<typename T> template<typename U> void ImportClsTmplMemTmpl<T>::staticDef() {} // expected-warning{{'ImportClsTmplMemTmpl::staticDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
1135 template<typename T> template<typename U> void ImportClsTmplMemTmpl<T>::staticInlineDecl() {}
1141 template<typename T> template<typename U> inline void ImportClsTmplMemTmpl<T>::normalInlineDef() {}
1142 template<typename T> template<typename U> inline void ImportClsTmplMemTmpl<T>::staticInlineDef() {}
1145 template<typename T> template<typename U> int ImportClsTmplMemTmpl<T>::StaticFieldDef; // expected-warning{{definition of dllimport static field}}
1146 template<typename T> template<typename U> const int ImportClsTmplMemTmpl<T>::StaticConstFieldDef = 1; // expected-warning{{definition of dllimport static field}}
1147 template<typename T> template<typename U> constexpr int ImportClsTmplMemTmpl<T>::ConstexprFieldDef; // expected-warning{{definition of dllimport static field}}
1152 template<typename T>
1154 template<typename U> void normalDef(); // expected-note{{previous declaration is here}}
1155 template<typename U> inline void normalInlineDecl(); // expected-note{{previous declaration is here}}
1156 template<typename U> static void staticDef(); // expected-note{{previous declaration is here}}
1157 template<typename U> static inline void staticInlineDecl(); // expected-note{{previous declaration is here}}
1163 template<typename U> void normalInlineDef();
1164 template<typename U> static void staticInlineDef();
1167 template<typename U> static int StaticField; // expected-note{{previous declaration is here}}
1168 template<typename U> static const int StaticConstField; // expected-note{{previous declaration is here}}
1169 template<typename U> constexpr static int ConstexprField = 1; // expected-note{{previous declaration is here}}
1173 template<typename T> template<typename U> __declspec(dllimport) void CTMTR<T>::normalDef() {} // expected-error{{redeclaration of 'CTMTR::normalDef' cannot add 'dllimport' attribute}}
1175 template<typename T> template<typename U> __declspec(dllimport) void CTMTR<T>::normalInlineDecl() {} // expected-error{{redeclaration of 'CTMTR::normalInlineDecl' cannot add 'dllimport' attribute}}
1176 template<typename T> template<typename U> __declspec(dllimport) void CTMTR<T>::staticDef() {} // expected-error{{redeclaration of 'CTMTR::staticDef' cannot add 'dllimport' attribute}}
1178 template<typename T> template<typename U> __declspec(dllimport) void CTMTR<T>::staticInlineDecl() {} // expected-error{{redeclaration of 'CTMTR::staticInlineDecl' cannot add 'dllimport' attribute}}
1181 template<typename T> template<typename U> __declspec(dllimport) inline void CTMTR<T>::normalInlineDef() {} // expected-error{{redeclaration of 'CTMTR::normalInlineDef' cannot add 'dllimport' attribute}}
1182 template<typename T> template<typename U> __declspec(dllimport) inline void CTMTR<T>::staticInlineDef() {} // expected-error{{redeclaration of 'CTMTR::staticInlineDef' cannot add 'dllimport' attribute}}
1184 template<typename T> template<typename U> __declspec(dllimport) inline void CTMTR<T>::normalInlineDef() {} // expected-warning{{'dllimport' attribute ignored on inline function}}
1185 template<typename T> template<typename U> __declspec(dllimport) inline void CTMTR<T>::staticInlineDef() {} // expected-warning{{'dllimport' attribute ignored on inline function}}
1189 template<typename T> template<typename U> __declspec(dllimport) int CTMTR<T>::StaticField = 1; // expected-error{{redeclaration of 'CTMTR::StaticField' cannot add 'dllimport' attribute}}
1192 template<typename T> template<typename U> __declspec(dllimport) const int CTMTR<T>::StaticConstField = 1; // expected-error{{redeclaration of 'CTMTR::StaticConstField' cannot add 'dllimport' attribute}}
1195 template<typename T> template<typename U> __declspec(dllimport) constexpr int CTMTR<T>::ConstexprField; // expected-error{{redeclaration of 'CTMTR::ConstexprField' cannot add 'dllimport' attribute}}
1214 template <typename T> class ClassTemplate {};
1233 template <typename T> class __declspec(dllexport) ExportClassWithDllMember {
1239 template <typename T> struct S { static int x; };
1240 template <typename T> int S<T>::x = sizeof(T);
1241 template <> struct __declspec(dllimport) S<int> { static int x; }; // expected-note{{attribute is here}}
1247 template <typename> struct __declspec(dllimport) S {
1256 template <typename T> struct PartiallySpecializedClassTemplate {};
1257 template <typename T> struct __declspec(dllimport) PartiallySpecializedClassTemplate<T*> { void f() {} };
1259 template <typename T> struct ExpliciallySpecializedClassTemplate {};
1260 template <> struct __declspec(dllimport) ExpliciallySpecializedClassTemplate<int> { void f() {} };
1264 // Classes with template base classes
1267 template <typename T> class __declspec(dllexport) ExportedClassTemplate {};
1269 template <typename T> class __declspec(dllimport) ImportedClassTemplate {};
1288 extern template class ClassTemplate<float>;
1295 template <typename T> struct ExplicitlySpecializedTemplate { void func() {} };
1297 // expected-note@+2{{class template 'ExplicitlySpecializedTemplate<int>' was explicitly specialized here}}
1299 template <> struct ExplicitlySpecializedTemplate<int> { void func() {} };
1300 template <typename T> struct ExplicitlyExportSpecializedTemplate { void func() {} };
1301 template <> struct __declspec(dllexport) ExplicitlyExportSpecializedTemplate<int> { void func() {} };
1302 template <typename T> struct ExplicitlyImportSpecializedTemplate { void func() {} };
1303 template <> struct __declspec(dllimport) ExplicitlyImportSpecializedTemplate<int> { void func() {} };
1305 template <typename T> struct ExplicitlyInstantiatedTemplate { void func() {} };
1307 // expected-note@+2{{class template 'ExplicitlyInstantiatedTemplate<int>' was instantiated here}}
1309 template struct ExplicitlyInstantiatedTemplate<int>;
1310 template <typename T> struct ExplicitlyExportInstantiatedTemplate { void func() {} };
1311 template struct __declspec(dllexport) ExplicitlyExportInstantiatedTemplate<int>;
1312 template <typename T> struct ExplicitlyImportInstantiatedTemplate { void func() {} };
1313 template struct __declspec(dllimport) ExplicitlyImportInstantiatedTemplate<int>;
1316 // expected-warning@+3{{propagating dll attribute to explicitly specialized base class template without dll attribute is not supported}}
1328 // expected-warning@+3{{propagating dll attribute to already instantiated base class template without dll attribute is not supported}}
1339 template <typename T> struct ExplicitInstantiationDeclTemplateBase { void func() {} };
1340 extern template struct ExplicitInstantiationDeclTemplateBase<int>;