Lines Matching full:dllimport
18 __declspec(dllimport) typedef int typedef1; // expected-warning{{'dllimport' attribute only applies to variables, functions and classes}}
19 typedef __declspec(dllimport) int typedef2; // expected-warning{{'dllimport' attribute only applies to variables, functions and classes}}
20 typedef int __declspec(dllimport) typedef3; // expected-warning{{'dllimport' attribute only applies to variables, functions and classes}}
21 typedef __declspec(dllimport) void (*FunTy)(); // expected-warning{{'dllimport' attribute only applies to variables, functions and classes}}
22 enum __declspec(dllimport) Enum {}; // expected-warning{{'dllimport' attribute only applies to variables, functions and classes}}
24 enum class __declspec(dllimport) EnumClass {}; // expected-warning{{'dllimport' attribute only applies to variables, functions and classes}}
34 __declspec(dllimport) extern int ExternGlobalDecl;
36 // dllimport implies a declaration.
37 __declspec(dllimport) int GlobalDecl;
38 int **__attribute__((dllimport))* GlobalDeclChunkAttr;
39 int GlobalDeclAttr __attribute__((dllimport));
42 __declspec(dllimport) extern int ExternGlobalInit = 1; // expected-error{{definition of dllimport data}}
43 __declspec(dllimport) int GlobalInit1 = 1; // expected-error{{definition of dllimport data}}
44 int __declspec(dllimport) GlobalInit2 = 1; // expected-error{{definition of dllimport data}}
47 __declspec(dllimport) extern int ExternGlobalDeclInit; // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
48 int ExternGlobalDeclInit = 1; // expected-warning{{'ExternGlobalDeclInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
50 __declspec(dllimport) int GlobalDeclInit; // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
51 int GlobalDeclInit = 1; // expected-warning{{'GlobalDeclInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
53 int *__attribute__((dllimport)) GlobalDeclChunkAttrInit; // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
54 int *GlobalDeclChunkAttrInit = 0; // expected-warning{{'GlobalDeclChunkAttrInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
56 int GlobalDeclAttrInit __attribute__((dllimport)); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
57 int GlobalDeclAttrInit = 1; // expected-warning{{'GlobalDeclAttrInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
60 __declspec(dllimport) extern int GlobalRedecl1;
61 __declspec(dllimport) extern int GlobalRedecl1;
63 __declspec(dllimport) int GlobalRedecl2a;
64 __declspec(dllimport) int GlobalRedecl2a;
66 int *__attribute__((dllimport)) GlobalRedecl2b;
67 int *__attribute__((dllimport)) GlobalRedecl2b;
69 int GlobalRedecl2c __attribute__((dllimport));
70 int GlobalRedecl2c __attribute__((dllimport));
73 // and drop the dllimport with a warning.
74 __declspec(dllimport) extern int GlobalRedecl3; // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
75 extern int GlobalRedecl3; // expected-warning{{'GlobalRedecl3' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
78 __declspec(dllimport) extern int GlobalRedecl4; // expected-warning{{redeclaration of 'GlobalRedecl4' should not add 'dllimport' attribute}}
82 __declspec(dllimport) extern int GlobalRedecl5; // expected-warning{{redeclaration of 'GlobalRedecl5' should not add 'dllimport' attribute}}
86 __declspec(dllimport) static int StaticGlobal; // expected-error{{'StaticGlobal' must have external linkage when declared 'dllimport'}}
87 __declspec(dllimport) Internal InternalTypeGlobal; // expected-error{{'InternalTypeGlobal' must have external linkage when declared 'dllimport'}}
88 namespace { __declspec(dllimport) int InternalGlobal; } // expected-error{{'(anonymous namespace)::InternalGlobal' must have external linkage when declared 'dllimport'}}
89 namespace ns { __declspec(dllimport) int ExternalGlobal; }
91 __declspec(dllimport) auto InternalAutoTypeGlobal = Internal(); // expected-error{{'InternalAutoTypeGlobal' must have external linkage when declared 'dllimport'}}
92 // expected-error@-1{{definition of dllimport data}}
95 __declspec(dllimport) __thread int ThreadLocalGlobal; // expected-error{{'ThreadLocalGlobal' cannot be thread local when declared 'dllimport'}}
96 // This doesn't work on MinGW, because there, dllimport on the inline function is ignored.
98 inline void __declspec(dllimport) ImportedInlineWithThreadLocal() {
104 __declspec(dllimport) float LocalRedecl1; // expected-note{{previous declaration is here}}
105 __declspec(dllimport) float LocalRedecl2; // expected-note{{previous declaration is here}}
106 __declspec(dllimport) float LocalRedecl3; // expected-note{{previous declaration is here}}
108 __declspec(dllimport) int LocalRedecl1; // expected-error{{redeclaration of 'LocalRedecl1' with a different type: 'int' vs 'float'}}
109 int *__attribute__((dllimport)) LocalRedecl2; // expected-error{{redeclaration of 'LocalRedecl2' with a different type: 'int *' vs 'float'}}
110 int LocalRedecl3 __attribute__((dllimport)); // expected-error{{redeclaration of 'LocalRedecl3' with a different type: 'int' vs 'float'}}
112 __declspec(dllimport) int LocalVarDecl;
113 __declspec(dllimport) int LocalVarDef = 1; // expected-error{{definition of dllimport data}}
114 __declspec(dllimport) extern int ExternLocalVarDecl;
115 __declspec(dllimport) extern int ExternLocalVarDef = 1; // expected-error{{definition of dllimport data}}
116 __declspec(dllimport) static int StaticLocalVar; // expected-error{{'StaticLocalVar' must have external linkage when declared 'dllimport'}}
127 template<typename T> __declspec(dllimport) extern int ExternVarTmplDecl;
129 // dllimport implies a declaration.
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}}
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'}}
167 template<typename T> __declspec(dllimport) int ImportedVarTmpl;
179 template<> __declspec(dllimport) int ImportedVarTmpl<ExplicitSpec_Imported>;
180 template<> __declspec(dllimport) int ImportedVarTmpl<ExplicitSpec_Def_Imported> = 1; // expected-error{{definition of dllimport data}}
183 // explicit dllimport.
188 extern template __declspec(dllimport) int VarTmpl<ExplicitDecl_Imported>;
191 template __declspec(dllimport) int VarTmpl<ExplicitInst_Imported>;
194 template<> __declspec(dllimport) int VarTmpl<ExplicitSpec_Imported>;
195 template<> __declspec(dllimport) int VarTmpl<ExplicitSpec_Def_Imported> = 1; // expected-error{{definition of dllimport data}}
205 __attribute__((dllimport)) void decl1A(); // Sanity check with __attribute__
206 __declspec(dllimport) void decl1B();
208 void __attribute__((dllimport)) decl2A();
209 void __declspec(dllimport) decl2B();
212 __declspec(dllimport) void def() {} // expected-error{{dllimport cannot be applied to non-inline function definition}}
215 extern "C" __declspec(dllimport) void externC();
219 // expected-warning@+3{{'dllimport' attribute ignored on inline function}}
220 // expected-warning@+3{{'dllimport' attribute ignored on inline function}}
222 __declspec(dllimport) inline void inlineFunc1() {}
223 inline void __attribute__((dllimport)) inlineFunc2() {}
226 // expected-warning@+2{{'dllimport' attribute ignored on inline function}}
228 __declspec(dllimport) inline void inlineDecl();
231 __declspec(dllimport) void inlineDef();
233 // expected-warning@+2{{'inlineDef' redeclared inline; 'dllimport' attribute ignored}}
238 __declspec(dllimport) void redecl1();
239 __declspec(dllimport) void redecl1();
242 // and drop the dllimport with a warning.
243 __declspec(dllimport) void redecl2(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
244 void redecl2(); // expected-warning{{'redecl2' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
246 __declspec(dllimport) void redecl3(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
247 void redecl3() {} // expected-warning{{'redecl3' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
250 __declspec(dllimport) void redecl4(); // expected-warning{{redeclaration of 'redecl4' should not add 'dllimport' attribute}}
254 __declspec(dllimport) void redecl5(); // expected-warning{{redeclaration of 'redecl5' should not add 'dllimport' attribute}}
259 __declspec(dllimport) inline void redecl6() {} // expected-warning{{redeclaration of 'redecl6' should not add 'dllimport' attribute}}
262 __declspec(dllimport) inline void redecl6() {} // expected-warning{{'dllimport' attribute ignored on inline function}}
267 friend __declspec(dllimport) void friend1();
268 friend __declspec(dllimport) void friend2(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
269 friend __declspec(dllimport) void friend3(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
276 __declspec(dllimport) void friend1();
277 void friend2(); // expected-warning{{'friend2' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
278 void friend3() {} // expected-warning{{'friend3' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
279 __declspec(dllimport) void friend4(); // expected-warning{{redeclaration of 'friend4' should not add 'dllimport' attribute}}
281 dllimport) inline void friend5() {} // expected-warning{{redeclaration of 'friend5' should not add 'dllimport' attribute}}
283 __declspec(dllimport) inline void friend5() {} // expected-warning{{'dllimport' attribute ignored on inline function}}
287 void __declspec(dllimport) friend6(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
288 void __declspec(dllimport) friend7();
290 friend void friend6(); // expected-warning{{'friend6' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
294 // Implicit declarations can be redeclared with dllimport.
295 __declspec(dllimport) void* operator new(__SIZE_TYPE__ n);
298 __declspec(dllimport) static int staticFunc(); // expected-error{{'staticFunc' must have external linkage when declared 'dllimport'}}
299 __declspec(dllimport) Internal internalRetFunc(); // expected-error{{'internalRetFunc' must have external linkage when declared 'dllimport'}}
300 namespace { __declspec(dllimport) void internalFunc(); } // expected-error{{'(anonymous namespace)::internalFunc' must have external linkage when declared 'dllimport'}}
301 namespace ns { __declspec(dllimport) void externalFunc(); }
307 __declspec(dllimport) void deletedFunc() = delete; // expected-error{{attribute 'dllimport' cannot be applied to a deleted function}} expected-error{{dllimport cannot be applied to non-inline function definition}}
309 __declspec(dllimport) inline void deletedInlineFunc() = delete; // expected-error{{attribute 'dllimport' cannot be applied to a deleted function}}
311 __declspec(dllimport) inline void deletedInlineFunc() = delete; // expected-warning{{'dllimport' attribute ignored on inline function}}
321 template<typename T> __declspec(dllimport) void funcTmplDecl1();
322 template<typename T> void __declspec(dllimport) funcTmplDecl2();
325 template<typename T> __declspec(dllimport) void funcTmplDef() {} // expected-error{{dllimport cannot be applied to non-inline function definition}}
329 // expected-warning@+5{{'dllimport' attribute ignored on inline function}}
330 // expected-warning@+5{{'dllimport' attribute ignored on inline function}}
331 // expected-warning@+6{{'dllimport' attribute ignored on inline function}}
332 // expected-warning@+9{{'inlineFuncTmplDef' redeclared inline; 'dllimport' attribute ignored}}
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();
340 template<typename T> __declspec(dllimport) 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}}
354 template<typename T> __declspec(dllimport) void funcTmplRedecl4(); // expected-error{{redeclaration of 'funcTmplRedecl4' cannot add 'dllimport' attribute}}
358 template<typename T> __declspec(dllimport) inline void funcTmplRedecl5() {} // expected-error{{redeclaration of 'funcTmplRedecl5' cannot add 'dllimport' attribute}}
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}}
368 // expected-warning@+2{{'dllimport' attribute ignored on inline function}}
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}}
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(); }
387 template<typename T> __declspec(dllimport) void importedFuncTmplDecl();
389 // expected-warning@+2{{'dllimport' attribute ignored on inline function}}
391 template<typename T> __declspec(dllimport) inline void importedFuncTmpl() {}
401 // NB: MSVC fails this instantiation without explicit dllimport which is most
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>() {}
414 // explicit dllimport.
419 extern template __declspec(dllimport) void funcTmpl<ExplicitDecl_Imported>();
421 // expected-warning@+2{{'dllimport' attribute ignored on inline function}}
423 extern template __declspec(dllimport) void inlineFuncTmpl<ExplicitDecl_Imported>();
426 template __declspec(dllimport) void funcTmpl<ExplicitInst_Imported>();
428 // expected-warning@+2{{'dllimport' attribute ignored on inline function}}
430 template __declspec(dllimport) void inlineFuncTmpl<ExplicitInst_Imported>();
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}}
437 // expected-warning@+2{{'dllimport' attribute ignored on inline function}}
439 template<> __declspec(dllimport) inline void funcTmpl<ExplicitSpec_InlineDef_Imported>() {}
449 __declspec(dllimport) void normalDecl();
450 __declspec(dllimport) void normalDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
454 // expected-warning@+5{{'dllimport' attribute ignored on inline function}}
455 // expected-warning@+6{{'dllimport' attribute ignored on inline function}}
457 __declspec(dllimport) void normalDecl();
458 __declspec(dllimport) void normalDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
459 __declspec(dllimport) void normalInclass() {}
460 __declspec(dllimport) void normalInlineDef();
461 __declspec(dllimport) inline void normalInlineDecl();
463 // expected-warning@+5{{'dllimport' attribute ignored on inline function}}
464 // expected-warning@+6{{'dllimport' attribute ignored on inline function}}
466 __declspec(dllimport) virtual void virtualDecl();
467 __declspec(dllimport) virtual void virtualDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
468 __declspec(dllimport) virtual void virtualInclass() {}
469 __declspec(dllimport) virtual void virtualInlineDef();
470 __declspec(dllimport) virtual inline void virtualInlineDecl();
472 // expected-warning@+5{{'dllimport' attribute ignored on inline function}}
473 // expected-warning@+6{{'dllimport' attribute ignored on inline function}}
475 __declspec(dllimport) static void staticDecl();
476 __declspec(dllimport) static void staticDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
477 __declspec(dllimport) static void staticInclass() {}
478 __declspec(dllimport) static void staticInlineDef();
479 __declspec(dllimport) static inline void staticInlineDecl();
482 __declspec(dllimport) void protectedDecl();
484 __declspec(dllimport) void privateDecl();
487 __declspec(dllimport) int Field; // expected-warning{{'dllimport' attribute only applies to variables, functions and classes}}
488 __declspec(dllimport) static int StaticField;
489 __declspec(dllimport) static int StaticFieldDef; // expected-note{{attribute is here}}
490 __declspec(dllimport) static const int StaticConstField;
491 __declspec(dllimport) static const int StaticConstFieldDef; // expected-note{{attribute is here}}
492 __declspec(dllimport) static const int StaticConstFieldEqualInit = 1;
493 __declspec(dllimport) static const int StaticConstFieldBraceInit{1};
494 __declspec(dllimport) constexpr static int ConstexprField = 1;
495 __declspec(dllimport) constexpr static int ConstexprFieldDef = 1; // expected-note{{attribute is here}}
498 void ImportMembers::Nested::normalDef() {} // expected-warning{{'ImportMembers::Nested::normalDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
499 void ImportMembers::normalDef() {} // expected-warning{{'ImportMembers::normalDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
501 // expected-warning@+2{{'ImportMembers::normalInlineDef' redeclared inline; 'dllimport' attribute ignored}}
505 void ImportMembers::virtualDef() {} // expected-warning{{'ImportMembers::virtualDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
507 // expected-warning@+2{{'ImportMembers::virtualInlineDef' redeclared inline; 'dllimport' attribute ignored}}
511 void ImportMembers::staticDef() {} // expected-warning{{'ImportMembers::staticDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
513 // expected-warning@+2{{'ImportMembers::staticInlineDef' redeclared inline; 'dllimport' attribute ignored}}
518 int ImportMembers::StaticFieldDef; // expected-error{{definition of dllimport static field not allowed}}
519 const int ImportMembers::StaticConstFieldDef = 1; // expected-error{{definition of dllimport static field not allowed}}
520 constexpr int ImportMembers::ConstexprFieldDef; // expected-error{{definition of dllimport static field not allowed}}
525 __declspec(dllimport) void normalDef();
526 __declspec(dllimport) void normalInlineDef();
527 __declspec(dllimport) virtual void virtualDef();
528 __declspec(dllimport) virtual void virtualInlineDef();
529 __declspec(dllimport) static void staticDef();
530 __declspec(dllimport) static void staticInlineDef();
532 __declspec(dllimport) inline void normalInlineDecl();
533 __declspec(dllimport) virtual inline void virtualInlineDecl();
534 __declspec(dllimport) static inline void staticInlineDecl();
537 __declspec(dllimport) static int StaticField;
538 __declspec(dllimport) static const int StaticConstField;
539 __declspec(dllimport) constexpr static int ConstexprField = 1;
542 __declspec(dllimport) void ImportMemberDefs::normalDef() {} // expected-error{{dllimport cannot be applied to non-inline function definition}}
543 __declspec(dllimport) void ImportMemberDefs::virtualDef() {} // expected-error{{dllimport cannot be applied to non-inline function definition}}
544 __declspec(dllimport) void ImportMemberDefs::staticDef() {} // expected-error{{dllimport cannot be applied to non-inline function definition}}
546 __declspec(dllimport) inline void ImportMemberDefs::normalInlineDef() {}
547 __declspec(dllimport) void ImportMemberDefs::normalInlineDecl() {}
548 __declspec(dllimport) inline void ImportMemberDefs::virtualInlineDef() {}
549 __declspec(dllimport) void ImportMemberDefs::virtualInlineDecl() {}
550 __declspec(dllimport) inline void ImportMemberDefs::staticInlineDef() {}
551 __declspec(dllimport) void ImportMemberDefs::staticInlineDecl() {}
554 __declspec(dllimport) int ImportMemberDefs::StaticField; // expected-error{{definition of dllimport
555 __declspec(dllimport) const int ImportMemberDefs::StaticConstField = 1; // expected-error{{definition of dllimport static field not allowed}} expected-note{{attribute is here}}
556 __declspec(dllimport) constexpr int ImportMemberDefs::ConstexprField; // expected-error{{definition of dllimport static field not allowed}} expected-note{{attribute is here}}
561 __declspec(dllimport) ImportSpecials();
562 __declspec(dllimport) ~ImportSpecials();
563 __declspec(dllimport) ImportSpecials(const ImportSpecials&);
564 __declspec(dllimport) ImportSpecials& operator=(const ImportSpecials&);
565 __declspec(dllimport) ImportSpecials(ImportSpecials&&);
566 __declspec(dllimport) ImportSpecials& operator=(ImportSpecials&&);
573 __declspec(dllimport) ImportDeleted() = delete; // expected-error{{attribute 'dllimport' cannot be applied to a deleted function}}
574 __declspec(dllimport) ~ImportDeleted() = delete; // expected-error{{attribute 'dllimport' cannot be applied to a deleted function}}
575 __declspec(dllimport) ImportDeleted(const ImportDeleted&) = delete; // expected-error{{attribute 'dllimport' cannot be applied to a deleted function}}
576 __declspec(dllimport) ImportDeleted& operator=(const ImportDeleted&) = delete; // expected-error{{attribute 'dllimport' cannot be applied to a deleted function}}
577 __declspec(dllimport) ImportDeleted(ImportDeleted&&) = delete; // expected-error{{attribute 'dllimport' cannot be applied to a deleted function}}
578 __declspec(dllimport) ImportDeleted& operator=(ImportDeleted&&) = delete; // expected-error{{attribute 'dllimport' cannot be applied to a deleted function}}
579 __declspec(dllimport) void deleted() = delete; // expected-error{{attribute 'dllimport' cannot be applied to a deleted function}}
581 __declspec(dllimport) ImportDeleted() = delete; // expected-warning{{'dllimport' attribute ignored on inline function}}
582 __declspec(dllimport) ~ImportDeleted() = delete; // expected-warning{{'dllimport' attribute ignored on inline function}}
583 __declspec(dllimport) ImportDeleted(const ImportDeleted&) = delete; // expected-warning{{'dllimport' attribute ignored on inline function}}
584 __declspec(dllimport) ImportDeleted& operator=(const ImportDeleted&) = delete; // expected-warning{{'dllimport' attribute ignored on inline function}}
585 __declspec(dllimport) ImportDeleted(ImportDeleted&&) = delete; // expected-warning{{'dllimport' attribute ignored on inline function}}
586 __declspec(dllimport) ImportDeleted& operator=(ImportDeleted&&) = delete; // expected-warning{{'dllimport' attribute ignored on inline function}}
587 __declspec(dllimport) void deleted() = delete; // expected-warning{{'dllimport' attribute ignored on inline function}}
594 __declspec(dllimport) void* operator new(__SIZE_TYPE__);
595 __declspec(dllimport) void* operator new[](__SIZE_TYPE__);
596 __declspec(dllimport) void operator delete(void*);
597 __declspec(dllimport) void operator delete[](void*);
604 // expected-warning@+7{{'dllimport' attribute ignored on inline function}}
605 // expected-warning@+7{{'dllimport' attribute ignored on inline function}}
606 // expected-warning@+7{{'dllimport' attribute ignored on inline function}}
607 // expected-warning@+7{{'dllimport' attribute ignored on inline function}}
608 // expected-warning@+7{{'dllimport' attribute ignored on inline function}}
609 // expected-warning@+7{{'dllimport' attribute ignored on inline function}}
611 __declspec(dllimport) ImportDefaulted() = default;
612 __declspec(dllimport) ~ImportDefaulted() = default;
613 __declspec(dllimport) ImportDefaulted(const ImportDefaulted&) = default;
614 __declspec(dllimport) ImportDefaulted& operator=(const ImportDefaulted&) = default;
615 __declspec(dllimport) ImportDefaulted(ImportDefaulted&&) = default;
616 __declspec(dllimport) ImportDefaulted& operator=(ImportDefaulted&&) = default;
622 __declspec(dllimport) ImportDefaultedDefs();
623 __declspec(dllimport) ~ImportDefaultedDefs(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
626 // expected-warning@+3{{'dllimport' attribute ignored on inline function}}
629 __declspec(dllimport) inline ImportDefaultedDefs(const ImportDefaultedDefs&);
630 __declspec(dllimport) ImportDefaultedDefs& operator=(const ImportDefaultedDefs&);
632 __declspec(dllimport) ImportDefaultedDefs(ImportDefaultedDefs&&);
633 __declspec(dllimport) ImportDefaultedDefs& operator=(ImportDefaultedDefs&&); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
637 __declspec(dllimport) ImportDefaultedDefs::ImportDefaultedDefs() = default; // expected-error{{dllimport cannot be applied to non-inline function definition}}
639 // dllimport cannot be dropped.
640 ImportDefaultedDefs::~ImportDefaultedDefs() = default; // expected-warning{{'ImportDefaultedDefs::~ImportDefaultedDefs' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
644 // expected-error@+3{{redeclaration of 'ImportDefaultedDefs::ImportDefaultedDefs' cannot add 'dllimport' attribute}}
645 // expected-warning@+3{{'ImportDefaultedDefs::operator=' redeclared inline; 'dllimport' attribute ignored}}
647 __declspec(dllimport) ImportDefaultedDefs::ImportDefaultedDefs(const ImportDefaultedDefs&) = default;
650 __declspec(dllimport) ImportDefaultedDefs::ImportDefaultedDefs(ImportDefaultedDefs&&) = default; // expected-error{{dllimport cannot be applied to non-inline function definition}}
651 ImportDefaultedDefs& ImportDefaultedDefs::operator=(ImportDefaultedDefs&&) = default; // expected-warning{{'ImportDefaultedDefs::operator=' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
654 // Redeclarations cannot add dllimport.
677 __declspec(dllimport) void MemberRedecl::normalDef() {} // expected-error{{redeclaration of 'MemberRedecl::normalDef' cannot add 'dllimport' attribute}}
678 // expected-error@-1{{dllimport cannot be applied to non-inline function definition}}
679 __declspec(dllimport) void MemberRedecl::normalInlineDecl() {} // expected-error{{redeclaration of 'MemberRedecl::normalInlineDecl' cannot add 'dllimport' attribute}}
680 __declspec(dllimport) void MemberRedecl::virtualDef() {} // expected-error{{redeclaration of 'MemberRedecl::virtualDef' cannot add 'dllimport' attribute}}
681 // expected-error@-1{{dllimport cannot be applied to non-inline function definition}}
682 __declspec(dllimport) void MemberRedecl::virtualInlineDecl() {} // expected-error{{redeclaration of 'MemberRedecl::virtualInlineDecl' cannot add 'dllimport' attribute}}
683 __declspec(dllimport) void MemberRedecl::staticDef() {} // expected-error{{redeclaration of 'MemberRedecl::staticDef' cannot add 'dllimport' attribute}}
684 // expected-error@-1{{dllimport cannot be applied to non-inline function definition}}
685 __declspec(dllimport) void MemberRedecl::staticInlineDecl() {} // expected-error{{redeclaration of 'MemberRedecl::staticInlineDecl' cannot add 'dllimport' attribute}}
688 __declspec(dllimport) inline void MemberRedecl::normalInlineDef() {} // expected-error{{redeclaration of 'MemberRedecl::normalInlineDef' cannot add 'dllimport' attribute}}
689 __declspec(dllimport) inline void MemberRedecl::virtualInlineDef() {} // expected-error{{redeclaration of 'MemberRedecl::virtualInlineDef' cannot add 'dllimport' attribute}}
690 __declspec(dllimport) inline void MemberRedecl::staticInlineDef() {} // expected-error{{redeclaration of 'MemberRedecl::staticInlineDef' cannot add 'dllimport' attribute}}
692 __declspec(dllimport) inline void MemberRedecl::normalInlineDef() {} // expected-warning{{'dllimport' attribute ignored on inline function}}
693 __declspec(dllimport) inline void MemberRedecl::virtualInlineDef() {} // expected-warning{{'dllimport' attribute ignored on inline function}}
694 __declspec(dllimport) inline void MemberRedecl::staticInlineDef() {} // expected-warning{{'dllimport' attribute ignored on inline function}}
699 __declspec(dllimport) int MemberRedecl::StaticField = 1; // expected-error{{redeclaration of 'MemberRedecl::StaticField' cannot add 'dllimport' attribute}}
700 // expected-error@-1{{definition of dllimport static field not allowed}}
702 __declspec(dllimport) const int MemberRedecl::StaticConstField = 1; // expected-error{{redeclaration of 'MemberRedecl::StaticConstField' cannot add 'dllimport' attribute}}
703 // expected-error@-1{{definition of dllimport static field not allowed}}
705 __declspec(dllimport) constexpr int MemberRedecl::ConstexprField; // expected-error{{redeclaration of 'MemberRedecl::ConstexprField' cannot add 'dllimport' attribute}}
706 // expected-error@-1{{definition of dllimport static field not allowed}}
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();
724 // expected-warning@+5{{'dllimport' attribute ignored on inline function}}
725 // expected-warning@+5{{'dllimport' attribute ignored on inline function}}
726 // expected-warning@+5{{'dllimport' attribute ignored on inline function}}
727 // expected-warning@+5{{'dllimport' attribute ignored on inline function}}
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}}
748 template<typename T> void ImportMemberTmpl::staticDef() {} // expected-warning{{'ImportMemberTmpl::staticDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
752 // expected-warning@+3{{ImportMemberTmpl::normalInlineDef' redeclared inline; 'dllimport' attribute ignored}}
753 // expected-warning@+3{{ImportMemberTmpl::staticInlineDef' redeclared inline; 'dllimport' attribute ignored}}
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}}
765 // Redeclarations cannot add dllimport.
786 template<typename T> __declspec(dllimportdllimport' attribute}}
787 // expected-error@-1{{dllimport cannot be applied to non-inline function definition}}
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}}
795 // expected-error@-1{{dllimport cannot be applied to non-inline function definition}}
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}}
805 // expected-error@-1{{definition of dllimport static field not allowed}}
807 template<typename T> __declspec(dllimport) const int MemTmplRedecl::StaticConstField = 1; // expected-error{{redeclaration of 'MemTmplRedecl::StaticConstField' cannot add 'dllimport' attribute}}
808 // expected-error@-1{{definition of dllimport static field not allowed}}
810 template<typename T> __declspec(dllimport) constexpr int MemTmplRedecl::ConstexprField; // expected-error{{redeclaration of 'MemTmplRedecl::ConstexprField' cannot add 'dllimport' attribute}}
811 // expected-error@-1{{definition of dllimport static field not allowed}}
820 // expected-warning@+2{{'dllimport' attribute ignored on inline function}}
822 template<typename T> __declspec(dllimport) void importedNormal() {}
825 // expected-warning@+2{{'dllimport' attribute ignored on inline function}}
827 template<typename T> __declspec(dllimport) static void importedStatic() {}
843 // NB: MSVC fails this instantiation without explicit dllimport.
848 template<> __declspec(dllimport) void MemFunTmpl::importedNormal<ExplicitSpec_Imported>();
849 template<> __declspec(dllimport) void MemFunTmpl::importedNormal<ExplicitSpec_Def_Imported>() {} // error on mingw
851 // expected-warning@+2{{'dllimport' attribute ignored on inline function}}
853 template<> __declspec(dllimport) inline void MemFunTmpl::importedNormal<ExplicitSpec_InlineDef_Imported>() {}
856 // expected-error@-7{{dllimport cannot be applied to non-inline function definition}}
859 template<> __declspec(dllimport) void MemFunTmpl::importedStatic<ExplicitSpec_Imported>();
860 template<> __declspec(dllimport) void MemFunTmpl::importedStatic<ExplicitSpec_Def_Imported>() {} // error on mingw
862 // expected-warning@+2{{'dllimport' attribute ignored on inline function}}
864 template<> __declspec(dllimport) inline void MemFunTmpl::importedStatic<ExplicitSpec_InlineDef_Imported>() {}
867 // expected-error@-7{{dllimport cannot be applied to non-inline function definition}}
871 // explicit dllimport.
879 // expected-warning@+3{{'dllimport' attribute ignored on inline function}}
880 // expected-warning@+3{{'dllimport' attribute ignored on inline function}}
882 extern template __declspec(dllimport) void MemFunTmpl::normalDef<ExplicitDecl_Imported>();
883 extern template __declspec(dllimport) void MemFunTmpl::staticDef<ExplicitDecl_Imported>();
888 // expected-warning@+3{{'dllimport' attribute ignored on inline function}}
889 // expected-warning@+3{{'dllimport' attribute ignored on inline function}}
891 template __declspec(dllimport) void MemFunTmpl::normalDef<ExplicitInst_Imported>();
892 template __declspec(dllimport) void MemFunTmpl::staticDef<ExplicitInst_Imported>();
895 template<> __declspec(dllimport) void MemFunTmpl::normalDef<ExplicitSpec_Imported>();
896 template<> __declspec(dllimport) void MemFunTmpl::normalDef<ExplicitSpec_Def_Imported>() {} // error on mingw
898 // expected-warning@+2{{'dllimport' attribute ignored on inline function}}
900 template<> __declspec(dllimport) inline void MemFunTmpl::normalDef<ExplicitSpec_InlineDef_Imported>() {}
903 // expected-error@-7{{dllimport cannot be applied to non-inline function definition}}
906 template<> __declspec(dllimport) void MemFunTmpl::staticDef<ExplicitSpec_Imported>();
907 template<> __declspec(dllimport) void MemFunTmpl::staticDef<ExplicitSpec_Def_Imported>() {} // error on mingw
909 // expected-warning@+2{{'dllimport' attribute ignored on inline function}}
911 template<> __declspec(dllimport) inline void MemFunTmpl::staticDef<ExplicitSpec_InlineDef_Imported>() {}
914 // expected-error@-7{{dllimport cannot be applied to non-inline function definition}}
922 template<typename T> __declspec(dllimport) static const int ImportedStaticVar = 1;
937 template<> __declspec(dllimport) const int MemVarTmpl::ImportedStaticVar<ExplicitSpec_Imported>;
938 template<> __declspec(dllimport) const int MemVarTmpl::ImportedStaticVar<ExplicitSpec_Def_Imported> = 1;
939 // expected-error@-1{{definition of dllimport static field not allowed}}
943 // dllimport.
949 extern template __declspec(dllimport) const int MemVarTmpl::StaticVar<ExplicitDecl_Imported>;
956 template<> __declspec(dllimport) const int MemVarTmpl::StaticVar<ExplicitSpec_Imported>;
957 template<> __declspec(dllimport) const int MemVarTmpl::StaticVar<ExplicitSpec_Def_Imported> = 1;
958 // expected-error@-1{{definition of dllimport static field not allowed}}
972 __declspec(dllimport) void normalDecl();
973 __declspec(dllimport) void normalDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
974 __declspec(dllimport) void normalInlineDef();
975 __declspec(dllimport) virtual void virtualDecl();
976 __declspec(dllimport) virtual void virtualDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
977 __declspec(dllimport) virtual void virtualInlineDef();
978 __declspec(dllimport) static void staticDecl();
979 __declspec(dllimport) static void staticDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
980 __declspec(dllimport) static void staticInlineDef();
983 // expected-warning@+7{{'dllimport' attribute ignored on inline function}}
984 // expected-warning@+7{{'dllimport' attribute ignored on inline function}}
985 // expected-warning@+7{{'dllimport' attribute ignored on inline function}}
986 // expected-warning@+7{{'dllimport' attribute ignored on inline function}}
987 // expected-warning@+7{{'dllimport' attribute ignored on inline function}}
988 // expected-warning@+7{{'dllimport' attribute ignored on inline function}}
990 __declspec(dllimport) void normalInclass() {}
991 __declspec(dllimport) inline void normalInlineDecl();
992 __declspec(dllimport) virtual void virtualInclass() {}
993 __declspec(dllimport) virtual inline void virtualInlineDecl();
994 __declspec(dllimport) static void staticInclass() {}
995 __declspec(dllimport) static inline void staticInlineDecl();
998 __declspec(dllimport) void protectedDecl();
1000 __declspec(dllimport) void privateDecl();
1003 __declspec(dllimport) int Field; // expected-warning{{'dllimport' attribute only applies to variables, functions and classes}}
1004 __declspec(dllimport) static int StaticField;
1005 __declspec(dllimport) static int StaticFieldDef; // expected-note{{attribute is here}}
1006 __declspec(dllimport) static const int StaticConstField;
1007 __declspec(dllimport) static const int StaticConstFieldDef; // expected-note{{attribute is here}}
1008 __declspec(dllimport) static const int StaticConstFieldEqualInit = 1;
1009 __declspec(dllimport) static const int StaticConstFieldBraceInit{1};
1010 __declspec(dllimport) constexpr static int ConstexprField = 1;
1011 __declspec(dllimport) constexpr static int ConstexprFieldDef = 1; // expected-note{{attribute is here}}
1016 template<typename T> void ImportClassTmplMembers<T>::normalDef() {} // expected-warning{{'ImportClassTmplMembers::normalDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
1018 // expected-warning@+2{{'ImportClassTmplMembers::normalInlineDef' redeclared inline; 'dllimport' attribute ignored}}
1022 template<typename T> void ImportClassTmplMembers<T>::virtualDef() {} // expected-warning{{'ImportClassTmplMembers::virtualDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
1024 // expected-warning@+2{{'ImportClassTmplMembers::virtualInlineDef' redeclared inline; 'dllimport' attribute ignored}}
1028 template<typename T> void ImportClassTmplMembers<T>::staticDef() {} // expected-warning{{'ImportClassTmplMembers::staticDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
1030 // expected-warning@+2{{'ImportClassTmplMembers::staticInlineDef' redeclared inline; 'dllimport' attribute ignored}}
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}}
1040 // Redeclarations cannot add dllimport.
1064 template<typename T> __declspec(dllimport) void CTMR<T>::normalDef() {} // expected-error{{redeclaration of 'CTMR::normalDef' cannot add 'dllimport' attribute}}
1065 // expected-error@-1{{dllimport cannot be applied to non-inline function definition}}
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}}
1068 // expected-error@-1{{dllimport cannot be applied to non-inline function definition}}
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}}
1071 // expected-error@-1{{dllimport cannot be applied to non-inline function definition}}
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}}
1085 // expected-warning@-1{{definition of dllimport static field}}
1087 template<typename T> __declspec(dllimport) const int CTMR<T>::StaticConstField = 1; // expected-error{{redeclaration of 'CTMR::StaticConstField' cannot add 'dllimport' attribute}}
1088 // expected-warning@-1{{definition of dllimport static field}}
1090 template<typename T> __declspec(dllimport) constexpr int CTMR<T>::ConstexprField; // expected-error{{redeclaration of 'CTMR::ConstexprField' cannot add 'dllimport' attribute}}
1091 // expected-warning@-1{{definition of dllimport static field}}
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();
1110 // expected-warning@+5{{'dllimport' attribute ignored on inline function}}
1111 // expected-warning@+5{{'dllimport' attribute ignored on inline function}}
1112 // expected-warning@+5{{'dllimport' attribute ignored on inline function}}
1113 // expected-warning@+5{{'dllimport' attribute ignored on inline function}}
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}}
1134 template<typename T> template<typename U> void ImportClsTmplMemTmpl<T>::staticDef() {} // expected-warning{{'ImportClsTmplMemTmpl::staticDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
1138 // expected-warning@+3{{'ImportClsTmplMemTmpl::normalInlineDef' redeclared inline; 'dllimport' attribute ignored}}
1139 // expected-warning@+3{{'ImportClsTmplMemTmpl::staticInlineDef' redeclared inline; 'dllimport' attribute ignored}}
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}}
1151 // Redeclarations cannot add dllimport.
1173 template<typename T> template<typename U> __declspec(dllimport) void CTMTR<T>::normalDef() {} // expected-error{{redeclaration of 'CTMTR::normalDef' cannot add 'dllimport' attribute}}
1174 // expected-error@-1{{dllimport cannot be applied to non-inline function definition}}
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}}
1177 // expected-error@-1{{dllimport cannot be applied to non-inline function definition}}
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}}
1190 // expected-warning@-1{{definition of dllimport static field}}
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}}
1193 // expected-warning@-1{{definition of dllimport static field}}
1195 template<typename T> template<typename U> __declspec(dllimport) constexpr int CTMTR<T>::ConstexprField; // expected-error{{redeclaration of 'CTMTR::ConstexprField' cannot add 'dllimport' attribute}}
1196 // expected-warning@-1{{definition of dllimport static field}}
1207 struct __declspec(dllimport) AnonymousClass {}; // expected-error{{(anonymous namespace)::AnonymousClass' must have external linkage when declared 'dllimport'}}
1210 class __declspec(dllimport) ClassDecl;
1212 class __declspec(dllimport) ClassDef { };
1219 // expected-error@+4{{attribute 'dllexport' cannot be applied to member of 'dllimport' class}}
1220 // expected-error@+4{{attribute 'dllimport' cannot be applied to member of 'dllimport' class}}
1222 class __declspec(dllimport) ImportClassWithDllMember {
1224 void __declspec(dllimport) bar();
1230 // expected-error@+4{{attribute 'dllimport' cannot be applied to member of 'dllexport' class}}
1234 void __declspec(dllimport) foo();
1241 template <> struct __declspec(dllimport) S<int> { static int x; }; // expected-note{{attribute is here}}
1242 int S<int>::x = -1; // expected-error{{definition of dllimport static field not allowed}}
1246 // Don't error about applying delete to dllimport member function when instantiating.
1247 template <typename> struct __declspec(dllimport) S {
1254 // expected-warning@+3{{'dllimport' attribute ignored}}
1257 template <typename T> struct __declspec(dllimport) PartiallySpecializedClassTemplate<T*> { void f() {} };
1260 template <> struct __declspec(dllimport) ExpliciallySpecializedClassTemplate<int> { void f() {} };
1269 template <typename T> class __declspec(dllimport) ImportedClassTemplate {};
1272 class __declspec(dllimport) DerivedFromTemplate : public ClassTemplate<int> {};
1275 class __declspec(dllimport
1278 class __declspec(dllimport) DerivedFromImportedTemplate : public ImportedClassTemplate<int> {};
1281 class __declspec(dllimport) DerivedFromExportedTemplate : public ExportedClassTemplate<int> {};
1285 class __declspec(dllimport) DerivedFromTemplateD2 : public ClassTemplate<double> {};
1289 class __declspec(dllimport) DerivedFromTemplateF : public ClassTemplate<float> {};
1291 class __declspec(dllimport) DerivedFromTemplateB : public ClassTemplate<bool> {};
1303 template <> struct __declspec(dllimport) ExplicitlyImportSpecializedTemplate<int> { void func() {} };
1313 template struct __declspec(dllimport) ExplicitlyImportInstantiatedTemplate<int>;
1319 struct __declspec(dllimport) DerivedFromExplicitlySpecializedTemplate : public ExplicitlySpecializedTemplate<int> {};
1322 struct __declspec(dllimport) DerivedFromExplicitlyExportSpecializedTemplate : public ExplicitlyExportSpecializedTemplate<int> {};
1325 struct __declspec(dllimport) DerivedFromExplicitlyImportSpecializedTemplate : public ExplicitlyImportSpecializedTemplate<int> {};
1331 struct __declspec(dllimport) DerivedFromExplicitlyInstantiatedTemplate : public ExplicitlyInstantiatedTemplate<int> {};
1334 struct __declspec(dllimport) DerivedFromExplicitlyExportInstantiatedTemplate : public ExplicitlyExportInstantiatedTemplate<int> {};
1337 struct __declspec(dllimport) DerivedFromExplicitlyImportInstantiatedTemplate : public ExplicitlyImportInstantiatedTemplate<int> {};
1341 struct __declspec(dllimport) DerivedFromExplicitInstantiationDeclTemplateBase : public ExplicitInstantiationDeclTemplateBase<int> {};
1348 // expected-error@+4{{lambda cannot be declared 'dllimport'}}
1350 // expected-warning@+2{{'dllimport' attribute ignored on inline function}}
1352 auto Lambda = []() __declspec(dllimport) -> bool { return true; };