// RUN: %clang_cc1 -triple i686-win32 -fsyntax-only -fms-extensions -verify -std=c++11 -Wunsupported-dll-base-class-template -DMS %s
// RUN: %clang_cc1 -triple x86_64-win32 -fsyntax-only -fms-extensions -verify -std=c++1y -Wunsupported-dll-base-class-template -DMS %s
// RUN: %clang_cc1 -triple i686-mingw32 -fsyntax-only -fms-extensions -verify -std=c++1y -Wunsupported-dll-base-class-template %s
// RUN: %clang_cc1 -triple x86_64-mingw32 -fsyntax-only -fms-extensions -verify -std=c++11 -Wunsupported-dll-base-class-template %s
// RUN: %clang_cc1 -triple i686-windows-itanium -fsyntax-only -fms-extensions -verify -std=c++11 -Wunsupported-dll-base-class-template -DWI %s
// RUN: %clang_cc1 -triple x86_64-windows-itanium -fsyntax-only -fms-extensions -verify -std=c++1y -Wunsupported-dll-base-class-template -DWI %s
// RUN: %clang_cc1 -triple x86_64-scei-ps4 -fsyntax-only -fdeclspec -verify -std=c++11 -Wunsupported-dll-base-class-template -DWI %s
// RUN: %clang_cc1 -triple x86_64-sie-ps5 -fsyntax-only -fdeclspec -verify -std=c++1y -Wunsupported-dll-base-class-template -DWI %s
// Helper structs to make templates more expressive.
;
;
;
;
;
;
;
;
// Invalid usage.
__declspec typedef int typedef1;
// expected-warning@-1{{'dllexport' attribute only applies to functions, variables, classes, and Objective-C interfaces}}
typedef __declspec int typedef2;
// expected-warning@-1{{'dllexport' attribute only applies to}}
typedef int __declspec typedef3;
// expected-warning@-1{{'dllexport' attribute only applies to}}
typedef __declspec void ;
// expected-warning@-1{{'dllexport' attribute only applies to}}
;
// expected-warning@-1{{'dllexport' attribute only applies to}}
;
// expected-warning@-1{{'dllexport' attribute only applies to}}
//===----------------------------------------------------------------------===//
// Globals
//===----------------------------------------------------------------------===//
// Export declaration.
__declspec extern int ExternGlobalDecl;
// dllexport implies a definition.
__declspec int GlobalDef;
// Export definition.
__declspec int GlobalInit1 = 1;
int __declspec GlobalInit2 = 1;
// Declare, then export definition.
__declspec extern int GlobalDeclInit;
int GlobalDeclInit = 1;
// Redeclarations
__declspec extern int GlobalRedecl1;
__declspec int GlobalRedecl1;
__declspec extern int GlobalRedecl2;
int GlobalRedecl2;
extern int GlobalRedecl3; // expected-note{{previous declaration is here}}
__declspec extern int GlobalRedecl3; // expected-warning{{redeclaration of 'GlobalRedecl3' should not add 'dllexport' attribute}}
extern "C"
// External linkage is required.
__declspec static int StaticGlobal; // expected-error{{'StaticGlobal' must have external linkage when declared 'dllexport'}}
__declspec Internal InternalTypeGlobal; // expected-error{{'InternalTypeGlobal' must have external linkage when declared 'dllexport'}}
// expected-error{{'(anonymous namespace)::InternalGlobal' must have external linkage when declared 'dllexport'}}
__declspec auto InternalAutoTypeGlobal = ; // expected-error{{'InternalAutoTypeGlobal' must have external linkage when declared 'dllexport'}}
__declspec auto ExternalAutoTypeGlobal = ;
// Thread local variables are invalid.
__declspec __thread int ThreadLocalGlobal; // expected-error{{'ThreadLocalGlobal' cannot be thread local when declared 'dllexport'}}
// But a static local TLS var in an export function is OK.
inline void __declspec
// Export in local scope.
void
//===----------------------------------------------------------------------===//
// Variable templates
//===----------------------------------------------------------------------===//
// Export declaration.
__declspec extern int ExternVarTmplDecl;
// dllexport implies a definition.
__declspec int VarTmplDef;
// Export definition.
__declspec int VarTmplInit1 = 1;
int __declspec VarTmplInit2 = 1;
// Declare, then export definition.
__declspec extern int VarTmplDeclInit;
int VarTmplDeclInit = 1;
// Redeclarations
__declspec extern int VarTmplRedecl1;
__declspec int VarTmplRedecl1 = 1;
__declspec extern int VarTmplRedecl2;
int VarTmplRedecl2 = 1;
extern int VarTmplRedecl3; // expected-note{{previous declaration is here}}
__declspec extern int VarTmplRedecl3; // expected-error{{redeclaration of 'VarTmplRedecl3' cannot add 'dllexport' attribute}}
// External linkage is required.
__declspec static int StaticVarTmpl; // expected-error{{'StaticVarTmpl' must have external linkage when declared 'dllexport'}}
__declspec Internal InternalTypeVarTmpl; // expected-error{{'InternalTypeVarTmpl' must have external linkage when declared 'dllexport'}}
// expected-error{{'(anonymous namespace)::InternalVarTmpl' must have external linkage when declared 'dllexport'}}
__declspec auto InternalAutoTypeVarTmpl = ; // expected-error{{'InternalAutoTypeVarTmpl' must have external linkage when declared 'dllexport'}}
__declspec auto ExternalAutoTypeVarTmpl = ;
;
int VarTmpl = 1;
__declspec int ExportedVarTmpl = 1;
// Export implicit instantiation of an exported variable template.
int
// Export explicit instantiation declaration of an exported variable template.
extern ;
;
// Export explicit instantiation definition of an exported variable template.
;
// Export specialization of an exported variable template.
__declspec int ExportedVarTmpl<ExplicitSpec_Exported>;
__declspec int ExportedVarTmpl<ExplicitSpec_Def_Exported> = 1;
// Not exporting specialization of an exported variable template without
// explicit dllexport.
int ExportedVarTmpl<ExplicitSpec_NotExported>;
// Export explicit instantiation declaration of a non-exported variable template.
extern ;
;
// Export explicit instantiation definition of a non-exported variable template.
;
// Export specialization of a non-exported variable template.
__declspec int VarTmpl<ExplicitSpec_Exported>;
__declspec int VarTmpl<ExplicitSpec_Def_Exported> = 1;
// __has_feature(cxx_variable_templates)
//===----------------------------------------------------------------------===//
// Functions
//===----------------------------------------------------------------------===//
// Export function declaration. Check different placements.
void ; // Correctness check with __attribute__
__declspec void ;
void ;
void __declspec ;
// Export function definition.
__declspec void
// extern "C"
extern "C" __declspec void
// Export inline function.
__declspec inline void
inline void
__declspec inline void ;
void
__declspec void ;
inline void
// Redeclarations
__declspec void ;
__declspec void
__declspec void ;
void
void ; // expected-note{{previous declaration is here}}
__declspec void ; // expected-warning{{redeclaration of 'redecl3' should not add 'dllexport' attribute}}
extern "C"
void ; // expected-note{{previous declaration is here}}
__declspec inline void // expected-warning{{redeclaration of 'redecl5' should not add 'dllexport' attribute}}
// Friend functions
;
__declspec void
void
__declspec void // expected-warning{{redeclaration of 'friend3' should not add 'dllexport' attribute}}
__declspec inline void // expected-warning{{redeclaration of 'friend4' should not add 'dllexport' attribute}}
// Implicit declarations can be redeclared with dllexport.
__declspec void* operator new;
// External linkage is required.
__declspec static int ; // expected-error{{'staticFunc' must have external linkage when declared 'dllexport'}}
__declspec Internal ; // expected-error{{'internalRetFunc' must have external linkage when declared 'dllexport'}}
// expected-error{{'(anonymous namespace)::internalFunc' must have external linkage when declared 'dllexport'}}
// Export deleted function.
__declspec void ; // expected-error{{attribute 'dllexport' cannot be applied to a deleted function}}
__declspec inline void ; // expected-error{{attribute 'dllexport' cannot be applied to a deleted function}}
//===----------------------------------------------------------------------===//
// Function templates
//===----------------------------------------------------------------------===//
// Export function template declaration. Check different placements.
__declspec void ;
void __declspec ;
// Export function template definition.
__declspec void
// Export inline function template.
__declspec inline void
inline void
__declspec inline void ;
void
__declspec void ;
inline void
// Redeclarations
__declspec void ;
__declspec void
__declspec void ;
void
void ; // expected-note{{previous declaration is here}}
__declspec void ; // expected-error{{redeclaration of 'funcTmplRedecl3' cannot add 'dllexport' attribute}}
void ; // expected-note{{previous declaration is here}}
__declspec inline void // expected-error{{redeclaration of 'funcTmplRedecl4' cannot add 'dllexport' attribute}}
// Function template friends
;
__declspec void
void
__declspec void // expected-error{{redeclaration of 'funcTmplFriend3' cannot add 'dllexport' attribute}}
__declspec inline void // expected-error{{redeclaration of 'funcTmplFriend4' cannot add 'dllexport' attribute}}
// External linkage is required.
__declspec static int ; // expected-error{{'staticFuncTmpl' must have external linkage when declared 'dllexport'}}
__declspec Internal ; // expected-error{{'internalRetFuncTmpl' must have external linkage when declared 'dllexport'}}
// expected-error{{'(anonymous namespace)::internalFuncTmpl' must have external linkage when declared 'dllexport'}}
void
__declspec void ;
__declspec void
// Export implicit instantiation of an exported function template.
void
void
// Export explicit instantiation declaration of an exported function template.
extern ;
;
// Export explicit instantiation definition of an exported function template.
;
// Export specialization of an exported function template.
__declspec void ;
__declspec void
__declspec inline void
// Not exporting specialization of an exported function template without
// explicit dllexport.
void
// Export explicit instantiation declaration of a non-exported function template.
extern ;
;
// Export explicit instantiation definition of a non-exported function template.
;
// Export specialization of a non-exported function template.
__declspec void ;
__declspec void
__declspec inline void
//===----------------------------------------------------------------------===//
// Classes
//===----------------------------------------------------------------------===//
;
;
// expected-warning@+3{{'dllexport' attribute ignored}}
;
;
;
;
// Don't instantiate class members of implicitly instantiated templates, even if they are exported.
;
;
ImplicitlyInstantiatedExportedTemplate<IncompleteType> implicitlyInstantiatedExportedTemplate;
// Don't instantiate class members of templates with explicit instantiation declarations, even if they are exported.
;
// expected-note@+2{{attribute is here}}
;
// expected-warning@+2{{explicit instantiation declaration should not be 'dllexport'}}
extern ;
// Instantiate class members for explicitly instantiated exported templates.
; // expected-note{{forward declaration of 'IncompleteType3'}}
;
; // expected-note{{in instantiation of member function 'ExplicitlyInstantiatedExportedTemplate<IncompleteType3>::f' requested here}}
// In MS mode, instantiate members of class templates that are base classes of exported classes.
// expected-note@+3{{forward declaration of 'IncompleteType4'}}
// expected-note@+3{{in instantiation of member function 'BaseClassTemplateOfExportedClass<IncompleteType4>::f' requested here}}
;
;
;
// Don't instantiate members of explicitly exported class templates that are base classes of exported classes.
;
;
;
// Warn about explicit instantiation declarations of dllexport classes.
;
// expected-warning@+2{{explicit instantiation declaration should not be 'dllexport'}} expected-note@+2{{attribute is here}}
extern ;
;
// expected-note@-2{{attribute is here}}
// expected-warning@+2{{explicit instantiation declaration should not be 'dllexport'}}
extern ;
;
void // No error; we don't try to export f because it has internal linkage.
//===----------------------------------------------------------------------===//
// Classes with template base classes
//===----------------------------------------------------------------------===//
;
;
;
;
// expected-note@+2{{class template 'ExplicitlySpecializedTemplate<int>' was explicitly specialized here}}
;
;
;
;
;
;
// expected-note@+2{{class template 'ExplicitlyInstantiatedTemplate<int>' was instantiated here}}
;
;
;
;
extern ;
// expected-warning@+2{{'dllexport' attribute ignored on explicit instantiation definition}}
;
;
;
// ClassTemplate<int> gets exported.
;
// ClassTemplate<int> is already exported.
;
// ExportedTemplate is explicitly exported.
;
// ImportedTemplate is explicitly imported.
;
;
// Base class previously implicitly instantiated without attribute; it will get propagated.
;
// Base class has explicit instantiation declaration; the attribute will get propagated.
extern ;
;
;
// The second derived class doesn't change anything, the attribute that was propagated first wins.
;
// expected-warning@+3{{propagating dll attribute to explicitly specialized base class template without dll attribute is not supported}}
// expected-note@+2{{attribute is here}}
;
// Base class alredy specialized with export attribute.
;
// Base class already specialized with import attribute.
;
// expected-warning@+3{{propagating dll attribute to already instantiated base class template without dll attribute is not supported}}
// expected-note@+2{{attribute is here}}
;
// Base class already instantiated with export attribute.
;
// Base class already instantiated with import attribute.
;
;
extern ;
;
//===----------------------------------------------------------------------===//
// Precedence
//===----------------------------------------------------------------------===//
// dllexport takes precedence over dllimport if both are specified.
extern int PrecedenceExternGlobal1A; // expected-warning{{'dllimport' attribute ignored}}
__declspec __declspec extern int PrecedenceExternGlobal1B; // expected-warning{{'dllimport' attribute ignored}}
extern int PrecedenceExternGlobal2A; // expected-warning{{'dllimport' attribute ignored}}
__declspec __declspec extern int PrecedenceExternGlobal2B; // expected-warning{{'dllimport' attribute ignored}}
int PrecedenceGlobal1A; // expected-warning{{'dllimport' attribute ignored}}
__declspec __declspec int PrecedenceGlobal1B; // expected-warning{{'dllimport' attribute ignored}}
int PrecedenceGlobal2A; // expected-warning{{'dllimport' attribute ignored}}
__declspec __declspec int PrecedenceGlobal2B; // expected-warning{{'dllimport' attribute ignored}}
__declspec extern int PrecedenceExternGlobalRedecl1;
__declspec extern int PrecedenceExternGlobalRedecl1; // expected-warning{{'dllimport' attribute ignored}}
__declspec extern int PrecedenceExternGlobalRedecl2; // expected-warning{{'dllimport' attribute ignored}}
__declspec extern int PrecedenceExternGlobalRedecl2;
__declspec extern int PrecedenceGlobalRedecl1;
__declspec int PrecedenceGlobalRedecl1; // expected-warning{{'dllimport' attribute ignored}}
__declspec extern int PrecedenceGlobalRedecl2; // expected-warning{{'dllimport' attribute ignored}}
__declspec int PrecedenceGlobalRedecl2;
void // expected-warning{{'dllimport' attribute ignored}}
void __declspec __declspec // expected-warning{{'dllimport' attribute ignored}}
void // expected-warning{{'dllimport' attribute ignored}}
void __declspec __declspec // expected-warning{{'dllimport' attribute ignored}}
void __declspec ; // expected-warning{{'dllimport' attribute ignored}}
void __declspec
void __declspec ;
void __declspec // expected-warning{{'dllimport' attribute ignored}}
//===----------------------------------------------------------------------===//
// Class members
//===----------------------------------------------------------------------===//
// Export individual members of a class.
;
void
void
inline void
void
void
inline void
void
void
inline void
void
void
void
int ExportMembers::StaticFieldDef;
const int ExportMembers::StaticConstFieldDef = 1;
constexpr int ExportMembers::ConstexprFieldDef;
// Export on member definitions.
;
__declspec void
__declspec inline void
__declspec void
__declspec void
__declspec inline void
__declspec void
__declspec void
__declspec inline void
__declspec void
__declspec int ExportMemberDefs::StaticField;
__declspec const int ExportMemberDefs::StaticConstField = 1;
__declspec constexpr int ExportMemberDefs::ConstexprField;
// Export special member functions.
;
inline ExportSpecials&
ExportSpecials&
// Export allocation functions.
extern "C" void* ;
extern "C" void ;
;
void* ExportAlloc::operator new
void* ExportAlloc::operator new
void ExportAlloc::operator delete
void ExportAlloc::operator delete[]
// Export deleted member functions.
;
// Export defaulted member functions.
;
// Export defaulted member function definitions.
;
// Export definitions.
__declspec ;
;
// Export inline declaration and definition.
__declspec ;
inline ExportDefaultedDefs& ;
__declspec ;
ExportDefaultedDefs& ;
// Redeclarations cannot add dllexport.
;
__declspec void // expected-error{{redeclaration of 'MemberRedecl::normalDef' cannot add 'dllexport' attribute}}
__declspec inline void // expected-error{{redeclaration of 'MemberRedecl::normalInlineDef' cannot add 'dllexport' attribute}}
__declspec void // expected-error{{redeclaration of 'MemberRedecl::normalInlineDecl' cannot add 'dllexport' attribute}}
__declspec void // expected-error{{redeclaration of 'MemberRedecl::virtualDef' cannot add 'dllexport' attribute}}
__declspec inline void // expected-error{{redeclaration of 'MemberRedecl::virtualInlineDef' cannot add 'dllexport' attribute}}
__declspec void // expected-error{{redeclaration of 'MemberRedecl::virtualInlineDecl' cannot add 'dllexport' attribute}}
__declspec void // expected-error{{redeclaration of 'MemberRedecl::staticDef' cannot add 'dllexport' attribute}}
__declspec inline void // expected-error{{redeclaration of 'MemberRedecl::staticInlineDef' cannot add 'dllexport' attribute}}
__declspec void // expected-error{{redeclaration of 'MemberRedecl::staticInlineDecl' cannot add 'dllexport' attribute}}
__declspec int MemberRedecl::StaticField = 1; // expected-error{{redeclaration of 'MemberRedecl::StaticField' cannot add 'dllexport' attribute}}
__declspec const int MemberRedecl::StaticConstField = 1; // expected-error{{redeclaration of 'MemberRedecl::StaticConstField' cannot add 'dllexport' attribute}}
// expected-warning@+4{{attribute declaration must precede definition}}
// expected-error@+2{{redeclaration of 'MemberRedecl::ConstexprField' cannot add 'dllexport' attribute}}
__declspec constexpr int MemberRedecl::ConstexprField;
;
;
;
;
; // expected-note {{in instantiation of member function 'HasDefaults<void>::HasDefaults' requested here}}
;
; // expected-note {{in instantiation of member function 'HasDefaults2<void>::HasDefaults2' requested here}}
;
HasDefaults3<void> ;
//===----------------------------------------------------------------------===//
// Class member templates
//===----------------------------------------------------------------------===//
;
void
inline void
void
void
inline void
void
int ExportMemberTmpl::StaticFieldDef;
const int ExportMemberTmpl::StaticConstFieldDef = 1;
constexpr int ExportMemberTmpl::ConstexprFieldDef;
// __has_feature(cxx_variable_templates)
// Redeclarations cannot add dllexport.
;
__declspec void // expected-error{{redeclaration of 'MemTmplRedecl::normalDef' cannot add 'dllexport' attribute}}
__declspec inline void // expected-error{{redeclaration of 'MemTmplRedecl::normalInlineDef' cannot add 'dllexport' attribute}}
__declspec void // expected-error{{redeclaration of 'MemTmplRedecl::normalInlineDecl' cannot add 'dllexport' attribute}}
__declspec void // expected-error{{redeclaration of 'MemTmplRedecl::staticDef' cannot add 'dllexport' attribute}}
__declspec inline void // expected-error{{redeclaration of 'MemTmplRedecl::staticInlineDef' cannot add 'dllexport' attribute}}
__declspec void // expected-error{{redeclaration of 'MemTmplRedecl::staticInlineDecl' cannot add 'dllexport' attribute}}
__declspec int MemTmplRedecl::StaticField = 1; // expected-error{{redeclaration of 'MemTmplRedecl::StaticField' cannot add 'dllexport' attribute}}
__declspec const int MemTmplRedecl::StaticConstField = 1; // expected-error{{redeclaration of 'MemTmplRedecl::StaticConstField' cannot add 'dllexport' attribute}}
// expected-warning@+4{{attribute declaration must precede definition}}
// expected-error@+2{{redeclaration of 'MemTmplRedecl::ConstexprField' cannot add 'dllexport' attribute}}
__declspec constexpr int MemTmplRedecl::ConstexprField;
// __has_feature(cxx_variable_templates)
;
// Export implicit instantiation of an exported member function template.
void
// Export explicit instantiation declaration of an exported member function
// template.
extern ;
;
extern ;
;
// Export explicit instantiation definition of an exported member function
// template.
;
;
// Export specialization of an exported member function template.
__declspec void ;
__declspec void
__declspec inline void
__declspec void ;
__declspec void
__declspec inline void
// Not exporting specialization of an exported member function template without
// explicit dllexport.
void
void
// Export explicit instantiation declaration of a non-exported member function
// template.
extern ;
;
extern ;
;
// Export explicit instantiation definition of a non-exported member function
// template.
;
;
// Export specialization of a non-exported member function template.
__declspec void ;
__declspec void
__declspec inline void
__declspec void ;
__declspec void
__declspec inline void
;
const int MemVarTmpl::StaticVar;
const int MemVarTmpl::ExportedStaticVar;
// Export implicit instantiation of an exported member variable template.
int
// Export explicit instantiation declaration of an exported member variable
// template.
extern ;
;
// Export explicit instantiation definition of an exported member variable
// template.
;
// Export specialization of an exported member variable template.
__declspec const int MemVarTmpl::ExportedStaticVar<ExplicitSpec_Exported>;
__declspec const int MemVarTmpl::ExportedStaticVar<ExplicitSpec_Def_Exported> = 1;
// Not exporting specialization of an exported member variable template without
// explicit dllexport.
const int MemVarTmpl::ExportedStaticVar<ExplicitSpec_NotExported>;
// Export explicit instantiation declaration of a non-exported member variable
// template.
extern ;
;
// Export explicit instantiation definition of a non-exported member variable
// template.
;
// Export specialization of a non-exported member variable template.
__declspec const int MemVarTmpl::StaticVar<ExplicitSpec_Exported>;
__declspec const int MemVarTmpl::StaticVar<ExplicitSpec_Def_Exported> = 1;
// __has_feature(cxx_variable_templates)
//===----------------------------------------------------------------------===//
// Class template members
//===----------------------------------------------------------------------===//
// Export individual members of a class template.
;
void
inline void
void
void
inline void
void
void
inline void
void
void
void
int ExportClassTmplMembers<T>::StaticFieldDef;
const int ExportClassTmplMembers<T>::StaticConstFieldDef = 1;
constexpr int ExportClassTmplMembers<T>::ConstexprFieldDef;
;
// Redeclarations cannot add dllexport.
;
__declspec void // expected-error{{redeclaration of 'CTMR::normalDef' cannot add 'dllexport' attribute}}
__declspec inline void // expected-error{{redeclaration of 'CTMR::normalInlineDef' cannot add 'dllexport' attribute}}
__declspec void // expected-error{{redeclaration of 'CTMR::normalInlineDecl' cannot add 'dllexport' attribute}}
__declspec void // expected-error{{redeclaration of 'CTMR::virtualDef' cannot add 'dllexport' attribute}}
__declspec inline void // expected-error{{redeclaration of 'CTMR::virtualInlineDef' cannot add 'dllexport' attribute}}
__declspec void // expected-error{{redeclaration of 'CTMR::virtualInlineDecl' cannot add 'dllexport' attribute}}
__declspec void // expected-error{{redeclaration of 'CTMR::staticDef' cannot add 'dllexport' attribute}}
__declspec inline void // expected-error{{redeclaration of 'CTMR::staticInlineDef' cannot add 'dllexport' attribute}}
__declspec void // expected-error{{redeclaration of 'CTMR::staticInlineDecl' cannot add 'dllexport' attribute}}
__declspec int CTMR<T>::StaticField = 1; // expected-error{{redeclaration of 'CTMR::StaticField' cannot add 'dllexport' attribute}}
__declspec const int CTMR<T>::StaticConstField = 1; // expected-error{{redeclaration of 'CTMR::StaticConstField' cannot add 'dllexport' attribute}}
// expected-warning@+4{{attribute declaration must precede definition}}
// expected-error@+2{{redeclaration of 'CTMR::ConstexprField' cannot add 'dllexport' attribute}}
__declspec constexpr int CTMR<T>::ConstexprField;
//===----------------------------------------------------------------------===//
// Class template member templates
//===----------------------------------------------------------------------===//
;
void
inline void
void
void
inline void
void
int ExportClsTmplMemTmpl<T>::StaticFieldDef;
const int ExportClsTmplMemTmpl<T>::StaticConstFieldDef = 1;
constexpr int ExportClsTmplMemTmpl<T>::ConstexprFieldDef;
// __has_feature(cxx_variable_templates)
// Redeclarations cannot add dllexport.
;
__declspec void // expected-error{{redeclaration of 'CTMTR::normalDef' cannot add 'dllexport' attribute}}
__declspec inline void // expected-error{{redeclaration of 'CTMTR::normalInlineDef' cannot add 'dllexport' attribute}}
__declspec void // expected-error{{redeclaration of 'CTMTR::normalInlineDecl' cannot add 'dllexport' attribute}}
__declspec void // expected-error{{redeclaration of 'CTMTR::staticDef' cannot add 'dllexport' attribute}}
__declspec inline void // expected-error{{redeclaration of 'CTMTR::staticInlineDef' cannot add 'dllexport' attribute}}
__declspec void // expected-error{{redeclaration of 'CTMTR::staticInlineDecl' cannot add 'dllexport' attribute}}
__declspec int CTMTR<T>::StaticField = 1; // expected-error{{redeclaration of 'CTMTR::StaticField' cannot add 'dllexport' attribute}}
__declspec const int CTMTR<T>::StaticConstField = 1; // expected-error{{redeclaration of 'CTMTR::StaticConstField' cannot add 'dllexport' attribute}}
// expected-warning@+4{{attribute declaration must precede definition}}
// expected-error@+2{{redeclaration of 'CTMTR::ConstexprField' cannot add 'dllexport' attribute}}
__declspec constexpr int CTMTR<T>::ConstexprField;
// __has_feature(cxx_variable_templates)
// FIXME: Precedence rules seem to be different for classes.
//===----------------------------------------------------------------------===//
// Lambdas
//===----------------------------------------------------------------------===//
// The MS ABI doesn't provide a stable mangling for lambdas, so they can't be imported or exported.
// expected-error@+2{{lambda cannot be declared 'dllexport'}}
auto Lambda = __declspec -> bool ;