diff --git a/tests/CLI/CLI.h b/tests/CLI/CLI.h index 20a7d8e5..e26691fc 100644 --- a/tests/CLI/CLI.h +++ b/tests/CLI/CLI.h @@ -68,9 +68,7 @@ public: TestMappedTypeNonConstRefParam(const std::string); const TestMappedTypeNonConstRefParam& operator=(const std::string); - DISABLE_WARNING_ONCE(4251, - std::string m_str; - ) + std::string m_str; }; class DLL_API TestMappedTypeNonConstRefParamConsumer diff --git a/tests/CSharp/CSharp.h b/tests/CSharp/CSharp.h index 44a046f7..7ed21ced 100644 --- a/tests/CSharp/CSharp.h +++ b/tests/CSharp/CSharp.h @@ -60,10 +60,7 @@ public: protected: int P; TemplateInAnotherUnit templateInAnotherUnit; - - DISABLE_WARNING_ONCE(4251, - std::string _name; - ) + std::string _name; }; class DLL_API Quux @@ -1124,16 +1121,13 @@ public: static const char Chr; static const unsigned char UChr; static const int Int; - static const float Float; + static const float Float; + static const std::string String; static const char ChrArray[2]; static const int IntArray[2]; static const float FloatArray[2]; static const bool BoolArray[2]; static const void* VoidPtrArray[2]; - - DISABLE_WARNING_ONCE(4251, - static const std::string String; - ) }; static constexpr double ConstexprCreateDoubleValue(double value) { diff --git a/tests/CSharp/CSharpTemplates.h b/tests/CSharp/CSharpTemplates.h index 85d49d21..93a81708 100644 --- a/tests/CSharp/CSharpTemplates.h +++ b/tests/CSharp/CSharpTemplates.h @@ -33,7 +33,7 @@ class DLL_API Ignored }; template -class DLL_API IndependentFields : public T1 +class IndependentFields : public T1 { typedef T Type; public: @@ -45,7 +45,7 @@ public: IndependentFields(float f); ~IndependentFields(); explicit IndependentFields(const std::map &other); - int getIndependent(); + float getIndependent(); T getDependent(const T& t); Type property(); static T staticDependent(const T& t); @@ -120,9 +120,9 @@ T IndependentFields::staticDependent(const T& t) } template -int IndependentFields::getIndependent() +float IndependentFields::getIndependent() { - return static_cast(independent); + return independent; } template @@ -143,7 +143,7 @@ class Base }; template -class DLL_API DependentValueFields : public Base +class DependentValueFields : public Base { public: class Nested; @@ -248,7 +248,7 @@ public: }; template -class DLL_API DependentPointerFields +class DependentPointerFields { public: DependentPointerFields(T t = 0); @@ -318,7 +318,7 @@ void TwoTemplateArgs::takeDependentPtrToSecondTemplateArg(const V& v) } template > -class DLL_API HasDefaultTemplateArgument +class HasDefaultTemplateArgument { public: HasDefaultTemplateArgument(); @@ -688,7 +688,7 @@ enum class UsedInTemplatedIndexer }; template -class DLL_API QFlags +class QFlags { typedef int Int; typedef int (*Zero); diff --git a/tests/Common/Common.h b/tests/Common/Common.h index f0e27c2f..e125a643 100644 --- a/tests/Common/Common.h +++ b/tests/Common/Common.h @@ -808,12 +808,9 @@ public: HasStdString(); ~HasStdString(); std::string testStdString(const std::string& s); - std::string testStdStringPassedByValue(std::string s); + std::string testStdStringPassedByValue(std::string s); + std::string s; std::string& getStdString(); - - DISABLE_WARNING_ONCE(4251, - std::string s; - ) }; class DLL_API InternalCtorAmbiguity diff --git a/tests/Encodings/Encodings.h b/tests/Encodings/Encodings.h index 21b91be7..9ab7efd4 100644 --- a/tests/Encodings/Encodings.h +++ b/tests/Encodings/Encodings.h @@ -4,14 +4,11 @@ class DLL_API Foo { public: - DISABLE_WARNING_ONCE(4251, - static std::string StringVariable; - ) - Foo(); ~Foo(); const char* Unicode; + static std::string StringVariable; // TODO: VC++ does not support char16 // char16 chr16; diff --git a/tests/StandardLib/StandardLib.h b/tests/StandardLib/StandardLib.h index b49f517b..83102cd2 100644 --- a/tests/StandardLib/StandardLib.h +++ b/tests/StandardLib/StandardLib.h @@ -20,20 +20,18 @@ struct DLL_API TestVectors std::vector GetIntVector(); int SumIntVector(std::vector& vec); - DISABLE_WARNING_ONCE(4251, - // Should get mapped to List - std::vector IntVector; - // Should get mapped to List - std::vector IntPtrVector; - // Should get mapped to List - std::vector IntWrapperVector; - // Should get mapped to List - std::vector IntWrapperPtrVector; - // Should get mapped to List - std::vector IntWrapperValueTypeVector; - // Should get mapped to List - VectorTypedef IntWrapperValueTypeVectorTypedef; - ) + // Should get mapped to List + std::vector IntVector; + // Should get mapped to List + std::vector IntPtrVector; + // Should get mapped to List + std::vector IntWrapperVector; + // Should get mapped to List + std::vector IntWrapperPtrVector; + // Should get mapped to List + std::vector IntWrapperValueTypeVector; + // Should get mapped to List + VectorTypedef IntWrapperValueTypeVectorTypedef; }; struct DLL_API OStreamTest diff --git a/tests/Tests.h b/tests/Tests.h index 0197827d..d72f03aa 100644 --- a/tests/Tests.h +++ b/tests/Tests.h @@ -20,11 +20,9 @@ #define THISCALL __thiscall #endif -#define DISABLE_WARNING_ONCE(id, block) \ -__pragma(warning(push)) \ -__pragma(warning(disable: id)) \ -block \ -__pragma(warning(pop)) +// HACK: work around https://developercommunity.visualstudio.com/content/problem/1269158/c4251-shown-for-any-not-explicitly-exported-templa.html +// harmless and requires exporting all template specializations +#pragma warning (disable : 4251 ) #else #define DLL_API __attribute__ ((visibility ("default"))) @@ -46,8 +44,6 @@ __pragma(warning(pop)) #define THISCALL #endif -#define DISABLE_WARNING_ONCE(id, block) block - #endif #define CS_OUT diff --git a/tests/VTables/VTables.h b/tests/VTables/VTables.h index 59304b03..40fa8880 100644 --- a/tests/VTables/VTables.h +++ b/tests/VTables/VTables.h @@ -17,10 +17,7 @@ public: virtual int append(); virtual int append(int a); int callVirtualWithParameter(int a); - - DISABLE_WARNING_ONCE(4251, - std::string s; - ) + std::string s; }; DLL_API int FooCallFoo(Foo* foo);