From eb3c620184f0d341d7333e4d88ef0a524aaf7ecb Mon Sep 17 00:00:00 2001 From: Nikolas Klauser Date: Fri, 31 Oct 2025 13:37:24 +0100 Subject: [PATCH] [Clang][NFC] Refactor SemaCXX/dllexport.cpp to use -verify= instead of macros --- clang/test/SemaCXX/dllexport.cpp | 180 ++++++++++--------------------- 1 file changed, 55 insertions(+), 125 deletions(-) diff --git a/clang/test/SemaCXX/dllexport.cpp b/clang/test/SemaCXX/dllexport.cpp index f503e2fc311d1..169af5cacc6c7 100644 --- a/clang/test/SemaCXX/dllexport.cpp +++ b/clang/test/SemaCXX/dllexport.cpp @@ -1,13 +1,13 @@ -// 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 -DGNU %s -// RUN: %clang_cc1 -triple x86_64-mingw32 -fsyntax-only -fms-extensions -verify -std=c++11 -Wunsupported-dll-base-class-template -DGNU %s -// RUN: %clang_cc1 -triple i686-pc-cygwin -fsyntax-only -fms-extensions -verify -std=c++1y -Wunsupported-dll-base-class-template -DGNU %s -// RUN: %clang_cc1 -triple x86_64-pc-cygwin -fsyntax-only -fms-extensions -verify -std=c++11 -Wunsupported-dll-base-class-template -DGNU %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 -DPS %s -// RUN: %clang_cc1 -triple x86_64-sie-ps5 -fsyntax-only -fdeclspec -verify -std=c++1y -Wunsupported-dll-base-class-template -DPS %s +// RUN: %clang_cc1 -triple i686-win32 -fsyntax-only -fms-extensions -verify=expected,ms,non-gnu,ms-ps -std=c++11 -Wunsupported-dll-base-class-template %s +// RUN: %clang_cc1 -triple x86_64-win32 -fsyntax-only -fms-extensions -verify=expected,ms,non-gnu,ms-ps -std=c++1y -Wunsupported-dll-base-class-template %s +// RUN: %clang_cc1 -triple i686-mingw32 -fsyntax-only -fms-extensions -verify=expected,non-ms,gnu,win-gnu -std=c++1y -Wunsupported-dll-base-class-template %s +// RUN: %clang_cc1 -triple x86_64-mingw32 -fsyntax-only -fms-extensions -verify=expected,non-ms,gnu,win-gnu -std=c++11 -Wunsupported-dll-base-class-template %s +// RUN: %clang_cc1 -triple i686-pc-cygwin -fsyntax-only -fms-extensions -verify=expected,non-ms,gnu,win-gnu -std=c++1y -Wunsupported-dll-base-class-template %s +// RUN: %clang_cc1 -triple x86_64-pc-cygwin -fsyntax-only -fms-extensions -verify=expected,non-ms,gnu,win-gnu -std=c++11 -Wunsupported-dll-base-class-template %s +// RUN: %clang_cc1 -triple i686-windows-itanium -fsyntax-only -fms-extensions -verify=expected,non-ms,non-gnu,win-gnu -std=c++11 -Wunsupported-dll-base-class-template %s +// RUN: %clang_cc1 -triple x86_64-windows-itanium -fsyntax-only -fms-extensions -verify=expected,non-ms,non-gnu,win-gnu -std=c++1y -Wunsupported-dll-base-class-template %s +// RUN: %clang_cc1 -triple x86_64-scei-ps4 -fsyntax-only -fdeclspec -verify=expected,non-ms,non-gnu,ms-ps -std=c++11 -Wunsupported-dll-base-class-template %s +// RUN: %clang_cc1 -triple x86_64-sie-ps5 -fsyntax-only -fdeclspec -verify=expected,non-ms,non-gnu,ms-ps -std=c++1y -Wunsupported-dll-base-class-template %s // Helper structs to make templates more expressive. struct ImplicitInst_Exported {}; @@ -75,9 +75,7 @@ __declspec(dllexport) extern int GlobalRedecl4; // expected-warning{{redeclarati // External linkage is required. __declspec(dllexport) static int StaticGlobal; // expected-error{{'StaticGlobal' must have external linkage when declared 'dllexport'}} __declspec(dllexport) Internal InternalTypeGlobal; // expected-error{{'InternalTypeGlobal' must have external linkage when declared 'dllexport'}} -#ifndef MS -namespace { __declspec(dllexport) int InternalGlobal; } // expected-error{{'(anonymous namespace)::InternalGlobal' must have external linkage when declared 'dllexport'}} -#endif +namespace { __declspec(dllexport) int InternalGlobal; } // non-ms-error{{'(anonymous namespace)::InternalGlobal' must have external linkage when declared 'dllexport'}} namespace ns { __declspec(dllexport) int ExternalGlobal; } __declspec(dllexport) auto InternalAutoTypeGlobal = Internal(); // expected-error{{'InternalAutoTypeGlobal' must have external linkage when declared 'dllexport'}} @@ -132,9 +130,7 @@ template __declspec(dllexport) extern int VarTmplRedecl3; // expecte // External linkage is required. template __declspec(dllexport) static int StaticVarTmpl; // expected-error{{'StaticVarTmpl' must have external linkage when declared 'dllexport'}} template __declspec(dllexport) Internal InternalTypeVarTmpl; // expected-error{{'InternalTypeVarTmpl' must have external linkage when declared 'dllexport'}} -#ifndef MS -namespace { template __declspec(dllexport) int InternalVarTmpl; } // expected-error{{'(anonymous namespace)::InternalVarTmpl' must have external linkage when declared 'dllexport'}} -#endif +namespace { template __declspec(dllexport) int InternalVarTmpl; } // non-ms-error{{'(anonymous namespace)::InternalVarTmpl' must have external linkage when declared 'dllexport'}} namespace ns { template __declspec(dllexport) int ExternalVarTmpl = 1; } template __declspec(dllexport) auto InternalAutoTypeVarTmpl = Internal(); // expected-error{{'InternalAutoTypeVarTmpl' must have external linkage when declared 'dllexport'}} @@ -355,11 +351,8 @@ class __declspec(dllexport) ClassDecl; class __declspec(dllexport) ClassDef {}; -#if defined(MS) || defined (WI) || defined(PS) -// expected-warning@+3{{'dllexport' attribute ignored}} -#endif template struct PartiallySpecializedClassTemplate {}; -template struct __declspec(dllexport) PartiallySpecializedClassTemplate { void f() {} }; +template struct __declspec(dllexport) PartiallySpecializedClassTemplate { void f() {} }; // non-gnu-warning {{'dllexport' attribute ignored}} template struct ExpliciallySpecializedClassTemplate {}; template <> struct __declspec(dllexport) ExpliciallySpecializedClassTemplate { void f() {} }; @@ -373,16 +366,11 @@ ImplicitlyInstantiatedExportedTemplate implicitlyInstantiatedExp // Don't instantiate class members of templates with explicit instantiation declarations, even if they are exported. struct IncompleteType2; -#if defined(MS) || defined (WI) || defined(PS) -// expected-note@+2{{attribute is here}} -#endif -template struct __declspec(dllexport) ExportedTemplateWithExplicitInstantiationDecl { + +template struct __declspec(dllexport) ExportedTemplateWithExplicitInstantiationDecl { // non-gnu-note {{attribute is here}} int f() { return sizeof(T); } // no-error }; -#if defined(MS) || defined (WI) || defined(PS) -// expected-warning@+2{{explicit instantiation declaration should not be 'dllexport'}} -#endif -extern template struct ExportedTemplateWithExplicitInstantiationDecl; +extern template struct ExportedTemplateWithExplicitInstantiationDecl; // non-gnu-warning {{explicit instantiation declaration should not be 'dllexport'}} // Instantiate class members for explicitly instantiated exported templates. struct IncompleteType3; // expected-note{{forward declaration of 'IncompleteType3'}} @@ -392,16 +380,9 @@ template struct __declspec(dllexport) ExplicitlyInstantiatedExporte template struct ExplicitlyInstantiatedExportedTemplate; // expected-note{{in instantiation of member function 'ExplicitlyInstantiatedExportedTemplate::f' requested here}} // In MS mode, instantiate members of class templates that are base classes of exported classes. -#if defined(MS) || defined(PS) - // expected-note@+3{{forward declaration of 'IncompleteType4'}} - // expected-note@+3{{in instantiation of member function 'BaseClassTemplateOfExportedClass::f' requested here}} -#endif -struct IncompleteType4; -template struct BaseClassTemplateOfExportedClass { -#if defined(MS) || defined(PS) - // expected-error@+2{{invalid application of 'sizeof' to an incomplete type 'IncompleteType4'}} -#endif - int f() { return sizeof(T); }; +struct IncompleteType4; // ms-ps-note {{forward declaration of 'IncompleteType4'}} +template struct BaseClassTemplateOfExportedClass { // ms-ps-note {{in instantiation of member function 'BaseClassTemplateOfExportedClass::f' requested here}} + int f() { return sizeof(T); }; // ms-ps-error {{invalid application of 'sizeof' to an incomplete type 'IncompleteType4'}} }; struct __declspec(dllexport) ExportedBaseClass : public BaseClassTemplateOfExportedClass {}; @@ -414,17 +395,11 @@ struct __declspec(dllexport) ExportedBaseClass2 : public ExportedBaseClassTempla // Warn about explicit instantiation declarations of dllexport classes. template struct ExplicitInstantiationDeclTemplate {}; -#if defined(MS) || defined (WI) || defined(PS) -// expected-warning@+2{{explicit instantiation declaration should not be 'dllexport'}} expected-note@+2{{attribute is here}} -#endif -extern template struct __declspec(dllexport) ExplicitInstantiationDeclTemplate; +extern template struct __declspec(dllexport) ExplicitInstantiationDeclTemplate; // non-gnu-warning {{explicit instantiation declaration should not be 'dllexport'}} \ + non-gnu-note {{attribute is here}} -template struct __declspec(dllexport) ExplicitInstantiationDeclExportedTemplate {}; -#if defined(MS) || defined (WI) || defined(PS) -// expected-note@-2{{attribute is here}} -// expected-warning@+2{{explicit instantiation declaration should not be 'dllexport'}} -#endif -extern template struct ExplicitInstantiationDeclExportedTemplate; +template struct __declspec(dllexport) ExplicitInstantiationDeclExportedTemplate {}; // non-gnu-note {{attribute is here}} +extern template struct ExplicitInstantiationDeclExportedTemplate; // non-gnu-warning {{explicit instantiation declaration should not be 'dllexport'}} namespace { struct InternalLinkageType {}; } struct __declspec(dllexport) PR23308 { @@ -440,35 +415,23 @@ class __declspec(dllexport) ExportedClass {}; class __declspec(dllimport) ImportedClass {}; template class ClassTemplate {}; -#if not defined(MS) && not defined(PS) -// expected-error@+2{{'ExportedClassTemplate' must have external linkage when declared 'dllexport'}} -#endif -template class __declspec(dllexport) ExportedClassTemplate {}; +template class __declspec(dllexport) ExportedClassTemplate {}; // win-gnu-error {{'ExportedClassTemplate' must have external linkage when declared 'dllexport'}} template class __declspec(dllimport) ImportedClassTemplate {}; template struct ExplicitlySpecializedTemplate { void func() {} }; -#if defined(MS) || defined(PS) -// expected-note@+2{{class template 'ExplicitlySpecializedTemplate' was explicitly specialized here}} -#endif -template <> struct ExplicitlySpecializedTemplate { void func() {} }; +template <> struct ExplicitlySpecializedTemplate { void func() {} }; // ms-ps-note {{class template 'ExplicitlySpecializedTemplate' was explicitly specialized here}} template struct ExplicitlyExportSpecializedTemplate { void func() {} }; template <> struct __declspec(dllexport) ExplicitlyExportSpecializedTemplate { void func() {} }; template struct ExplicitlyImportSpecializedTemplate { void func() {} }; template <> struct __declspec(dllimport) ExplicitlyImportSpecializedTemplate { void func() {} }; template struct ExplicitlyInstantiatedTemplate { void func() {} }; -#if defined(MS) || defined(PS) -// expected-note@+2{{class template 'ExplicitlyInstantiatedTemplate' was instantiated here}} -#endif -template struct ExplicitlyInstantiatedTemplate; +template struct ExplicitlyInstantiatedTemplate; // ms-ps-note {{class template 'ExplicitlyInstantiatedTemplate' was instantiated here}} template struct ExplicitlyExportInstantiatedTemplate { void func() {} }; template struct __declspec(dllexport) ExplicitlyExportInstantiatedTemplate; template struct ExplicitlyExportDeclaredInstantiatedTemplate { void func() {} }; extern template struct ExplicitlyExportDeclaredInstantiatedTemplate; -#if not defined(MS) && not defined (WI) && not defined(PS) -// expected-warning@+2{{'dllexport' attribute ignored on explicit instantiation definition}} -#endif -template struct __declspec(dllexport) ExplicitlyExportDeclaredInstantiatedTemplate; +template struct __declspec(dllexport) ExplicitlyExportDeclaredInstantiatedTemplate; // gnu-warning {{'dllexport' attribute ignored on explicit instantiation definition}} template struct ExplicitlyImportInstantiatedTemplate { void func() {} }; template struct __declspec(dllimport) ExplicitlyImportInstantiatedTemplate; @@ -496,11 +459,8 @@ class __declspec(dllexport) DerivedFromTemplateB : public ClassTemplate {} // The second derived class doesn't change anything, the attribute that was propagated first wins. class __declspec(dllimport) DerivedFromTemplateB2 : public ClassTemplate {}; -#if defined(MS) || defined(PS) -// expected-warning@+3{{propagating dll attribute to explicitly specialized base class template without dll attribute is not supported}} -// expected-note@+2{{attribute is here}} -#endif -struct __declspec(dllexport) DerivedFromExplicitlySpecializedTemplate : public ExplicitlySpecializedTemplate {}; +struct __declspec(dllexport) DerivedFromExplicitlySpecializedTemplate : public ExplicitlySpecializedTemplate {}; // ms-ps-warning {{propagating dll attribute to explicitly specialized base class template without dll attribute is not supported}} \ + ms-ps-note {{attribute is here}} // Base class alredy specialized with export attribute. struct __declspec(dllexport) DerivedFromExplicitlyExportSpecializedTemplate : public ExplicitlyExportSpecializedTemplate {}; @@ -508,11 +468,8 @@ struct __declspec(dllexport) DerivedFromExplicitlyExportSpecializedTemplate : pu // Base class already specialized with import attribute. struct __declspec(dllexport) DerivedFromExplicitlyImportSpecializedTemplate : public ExplicitlyImportSpecializedTemplate {}; -#if defined(MS) || defined(PS) -// expected-warning@+3{{propagating dll attribute to already instantiated base class template without dll attribute is not supported}} -// expected-note@+2{{attribute is here}} -#endif -struct __declspec(dllexport) DerivedFromExplicitlyInstantiatedTemplate : public ExplicitlyInstantiatedTemplate {}; +struct __declspec(dllexport) DerivedFromExplicitlyInstantiatedTemplate : public ExplicitlyInstantiatedTemplate {}; // ms-ps-warning {{propagating dll attribute to already instantiated base class template without dll attribute is not supported}} \ + ms-ps-note {{attribute is here}} // Base class already instantiated with export attribute. struct __declspec(dllexport) DerivedFromExplicitlyExportInstantiatedTemplate : public ExplicitlyExportInstantiatedTemplate {}; @@ -528,10 +485,7 @@ void func() { // MSVC allows deriving from exported template classes in local contexts. class LocalDerivedFromExportedClass : public ExportedClass {}; class LocalDerivedFromExportedTemplate : public ExportedClassTemplate {}; -#if not defined(MS) && not defined (PS) - // expected-note@+2{{in instantiation of template class 'ExportedClassTemplate' requested here}} -#endif - class LocalCRTP : public ExportedClassTemplate {}; + class LocalCRTP : public ExportedClassTemplate {}; // win-gnu-note {{in instantiation of template class 'ExportedClassTemplate' requested here}} } //===----------------------------------------------------------------------===// @@ -778,46 +732,40 @@ __declspec(dllexport) void MemberRedecl::staticInlineDecl() {} // expect __declspec(dllexport) int MemberRedecl::StaticField = 1; // expected-error{{redeclaration of 'MemberRedecl::StaticField' cannot add 'dllexport' attribute}} __declspec(dllexport) const int MemberRedecl::StaticConstField = 1; // expected-error{{redeclaration of 'MemberRedecl::StaticConstField' cannot add 'dllexport' attribute}} -#ifdef MS -// expected-warning@+4{{attribute declaration must precede definition}} -#else -// expected-error@+2{{redeclaration of 'MemberRedecl::ConstexprField' cannot add 'dllexport' attribute}} -#endif -__declspec(dllexport) constexpr int MemberRedecl::ConstexprField; -#ifdef MS +__declspec(dllexport) constexpr int MemberRedecl::ConstexprField; // ms-warning {{attribute declaration must precede definition}} \ + non-ms-error {{redeclaration of 'MemberRedecl::ConstexprField' cannot add 'dllexport' attribute}} + struct __declspec(dllexport) ClassWithMultipleDefaultCtors { - ClassWithMultipleDefaultCtors(int = 40) {} // expected-error{{'__declspec(dllexport)' cannot be applied to more than one default constructor}} - ClassWithMultipleDefaultCtors(int = 30, ...) {} // expected-note{{declared here}} + ClassWithMultipleDefaultCtors(int = 40) {} // ms-error{{'__declspec(dllexport)' cannot be applied to more than one default constructor}} + ClassWithMultipleDefaultCtors(int = 30, ...) {} // ms-note{{declared here}} }; template struct ClassTemplateWithMultipleDefaultCtors { - __declspec(dllexport) ClassTemplateWithMultipleDefaultCtors(int = 40) {} // expected-error{{'__declspec(dllexport)' cannot be applied to more than one default constructor}} - __declspec(dllexport) ClassTemplateWithMultipleDefaultCtors(int = 30, ...) {} // expected-note{{declared here}} + __declspec(dllexport) ClassTemplateWithMultipleDefaultCtors(int = 40) {} // ms-error{{'__declspec(dllexport)' cannot be applied to more than one default constructor}} + __declspec(dllexport) ClassTemplateWithMultipleDefaultCtors(int = 30, ...) {} // ms-note{{declared here}} }; template struct HasDefaults { - HasDefaults(int x = sizeof(T)) {} // expected-error {{invalid application of 'sizeof'}} + HasDefaults(int x = sizeof(T)) {} // ms-error {{invalid application of 'sizeof'}} }; template struct __declspec(dllexport) HasDefaults; template struct -__declspec(dllexport) // expected-note {{in instantiation of default function argument expression for 'HasDefaults' required here}} -HasDefaults; // expected-note {{in instantiation of member function 'HasDefaults::HasDefaults' requested here}} +__declspec(dllexport) // ms-note {{in instantiation of default function argument expression for 'HasDefaults' required here}} +HasDefaults; // ms-note {{in instantiation of member function 'HasDefaults::HasDefaults' requested here}} template struct HasDefaults2 { - __declspec(dllexport) // expected-note {{in instantiation of default function argument expression for 'HasDefaults2' required here}} - HasDefaults2(int x = sizeof(T)) {} // expected-error {{invalid application of 'sizeof'}} + __declspec(dllexport) // ms-note {{in instantiation of default function argument expression for 'HasDefaults2' required here}} + HasDefaults2(int x = sizeof(T)) {} // ms-error {{invalid application of 'sizeof'}} }; -template struct HasDefaults2; // expected-note {{in instantiation of member function 'HasDefaults2::HasDefaults2' requested here}} +template struct HasDefaults2; // ms-note {{in instantiation of member function 'HasDefaults2::HasDefaults2' requested here}} -template struct __declspec(dllexport) HasDefaults3 { // expected-note{{in instantiation of default function argument expression for 'HasDefaults3' required here}} - HasDefaults3(int x = sizeof(T)) {} // expected-error {{invalid application of 'sizeof'}} +template struct __declspec(dllexport) HasDefaults3 { // ms-note{{in instantiation of default function argument expression for 'HasDefaults3' required here}} + HasDefaults3(int x = sizeof(T)) {} // ms-error {{invalid application of 'sizeof'}} }; template <> HasDefaults3::HasDefaults3(int) {}; -#endif - //===----------------------------------------------------------------------===// // Class member templates //===----------------------------------------------------------------------===// @@ -887,12 +835,8 @@ template __declspec(dllexport) void MemTmplRedecl::staticInli template __declspec(dllexport) int MemTmplRedecl::StaticField = 1; // expected-error{{redeclaration of 'MemTmplRedecl::StaticField' cannot add 'dllexport' attribute}} template __declspec(dllexport) const int MemTmplRedecl::StaticConstField = 1; // expected-error{{redeclaration of 'MemTmplRedecl::StaticConstField' cannot add 'dllexport' attribute}} -#ifdef MS -// expected-warning@+4{{attribute declaration must precede definition}} -#else -// expected-error@+2{{redeclaration of 'MemTmplRedecl::ConstexprField' cannot add 'dllexport' attribute}} -#endif -template __declspec(dllexport) constexpr int MemTmplRedecl::ConstexprField; +template __declspec(dllexport) constexpr int MemTmplRedecl::ConstexprField; // ms-warning {{attribute declaration must precede definition}} \ + non-ms-error {{redeclaration of 'MemTmplRedecl::ConstexprField' cannot add 'dllexport' attribute}} #endif // __has_feature(cxx_variable_templates) @@ -1097,20 +1041,13 @@ template __declspec(dllexport) void CTMR::staticInlineDecl template __declspec(dllexport) int CTMR::StaticField = 1; // expected-error{{redeclaration of 'CTMR::StaticField' cannot add 'dllexport' attribute}} template __declspec(dllexport) const int CTMR::StaticConstField = 1; // expected-error{{redeclaration of 'CTMR::StaticConstField' cannot add 'dllexport' attribute}} -#ifdef MS -// expected-warning@+4{{attribute declaration must precede definition}} -#else -// expected-error@+2{{redeclaration of 'CTMR::ConstexprField' cannot add 'dllexport' attribute}} -#endif -template __declspec(dllexport) constexpr int CTMR::ConstexprField; +template __declspec(dllexport) constexpr int CTMR::ConstexprField; // ms-warning {{attribute declaration must precede definition}} \ + non-ms-error {{redeclaration of 'CTMR::ConstexprField' cannot add 'dllexport' attribute}} // MSVC exports explicit specialization of exported class template member // function, and errors on such definitions. MinGW does not treat them as // dllexport. -#if !defined(GNU) -// expected-error@+2{{attribute 'dllexport' cannot be applied to a deleted function}} -#endif -template <> void ExportClassTmplMembers::normalDecl() = delete; +template <> void ExportClassTmplMembers::normalDecl() = delete; // non-gnu-error {{attribute 'dllexport' cannot be applied to a deleted function}} //===----------------------------------------------------------------------===// @@ -1183,12 +1120,8 @@ template template __declspec(dllexport) void CTMT #if __has_feature(cxx_variable_templates) template template __declspec(dllexport) int CTMTR::StaticField = 1; // expected-error{{redeclaration of 'CTMTR::StaticField' cannot add 'dllexport' attribute}} template template __declspec(dllexport) const int CTMTR::StaticConstField = 1; // expected-error{{redeclaration of 'CTMTR::StaticConstField' cannot add 'dllexport' attribute}} -#ifdef MS -// expected-warning@+4{{attribute declaration must precede definition}} -#else -// expected-error@+2{{redeclaration of 'CTMTR::ConstexprField' cannot add 'dllexport' attribute}} -#endif -template template __declspec(dllexport) constexpr int CTMTR::ConstexprField; +template template __declspec(dllexport) constexpr int CTMTR::ConstexprField; // ms-warning {{attribute declaration must precede definition}} \ + non-ms-error {{redeclaration of 'CTMTR::ConstexprField' cannot add 'dllexport' attribute}} #endif // __has_feature(cxx_variable_templates) // FIXME: Precedence rules seem to be different for classes. @@ -1197,7 +1130,4 @@ template template __declspec(dllexport) constexpr int CT // Lambdas //===----------------------------------------------------------------------===// // The MS ABI doesn't provide a stable mangling for lambdas, so they can't be imported or exported. -#if defined(MS) || defined (WI) || defined(PS) -// expected-error@+2{{lambda cannot be declared 'dllexport'}} -#endif -auto Lambda = []() __declspec(dllexport) -> bool { return true; }; +auto Lambda = []() __declspec(dllexport) -> bool { return true; }; // non-gnu-error {{lambda cannot be declared 'dllexport'}}