diff --git a/include/cereal/details/traits.hpp b/include/cereal/details/traits.hpp index bfea1cee..b2b38d33 100644 --- a/include/cereal/details/traits.hpp +++ b/include/cereal/details/traits.hpp @@ -46,6 +46,13 @@ namespace cereal typedef std::true_type yes; typedef std::false_type no; + namespace detail + { + //! Used to delay a static_assert until template instantiation + template + struct delay_static_assert : std::false_type {}; + } // namespace detail + #ifdef CEREAL_OLDER_GCC // when VS supports better SFINAE, we can use this as the default template struct Void { typedef void type; }; #endif // CEREAL_OLDER_GCC @@ -583,7 +590,8 @@ namespace cereal template ::value, bool NonMember = traits::has_non_member_load_and_construct::value> struct Construct { - static_assert( !sizeof(T), "Cereal detected both member and non member load_and_construct functions!" ); + static_assert( cereal::traits::detail::delay_static_assert::value, + "Cereal detected both member and non member load_and_construct functions!" ); static T * load_andor_construct( A & /*ar*/, construct & /*construct*/ ) { return nullptr; } }; diff --git a/include/cereal/types/common.hpp b/include/cereal/types/common.hpp index ce682f93..25c1c47e 100644 --- a/include/cereal/types/common.hpp +++ b/include/cereal/types/common.hpp @@ -47,7 +47,8 @@ namespace cereal template inline void serialize( Archive &, T * & ) { - static_assert(!sizeof(T), "Cereal does not support serializing raw pointers - please use a smart pointer"); + static_assert(cereal::traits::detail::delay_static_assert::value, + "Cereal does not support serializing raw pointers - please use a smart pointer"); } namespace common_detail diff --git a/vs2013/sandbox/sandbox.vcxproj b/vs2013/sandbox/sandbox.vcxproj index 89ca7d73..1752cbc5 100644 --- a/vs2013/sandbox/sandbox.vcxproj +++ b/vs2013/sandbox/sandbox.vcxproj @@ -1,136 +1,138 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {DAC23DBB-630B-46B9-B115-F1449697898A} - sandbox - - - - Application - true - v120 - MultiByte - - - Application - true - v120 - MultiByte - - - Application - false - v120 - true - MultiByte - - - Application - false - v120 - true - MultiByte - - - - - - - - - - - - - - - - - - - $(SolutionDir)\..\include;C:\Boost\include\boost-1_54;$(IncludePath) - C:\Boost\lib;$(LibraryPath) - - - $(SolutionDir)\..\include;C:\Boost\include\boost-1_55;$(IncludePath) - - - $(SolutionDir)\..\include;C:\Boost\include\boost-1_54;$(IncludePath) - C:\Boost\lib;$(LibraryPath) - - - $(SolutionDir)\..\include;C:\Boost\include\boost-1_55;$(IncludePath) - - - - Level3 - Disabled - true - - - true - - - - - Level3 - Disabled - true - - - true - - - - - Level3 - MaxSpeed - true - true - true - - - true - true - true - - - - - Level3 - MaxSpeed - true - true - true - - - true - true - true - - - - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {DAC23DBB-630B-46B9-B115-F1449697898A} + sandbox + + + + Application + true + v120 + MultiByte + + + Application + true + v120 + MultiByte + + + Application + false + v120 + true + MultiByte + + + Application + false + v120 + true + MultiByte + + + + + + + + + + + + + + + + + + + $(SolutionDir)\..\include;C:\Boost\include\boost-1_54;$(IncludePath) + C:\Boost\lib;$(LibraryPath) + + + $(SolutionDir)\..\include;C:\Boost\include\boost-1_55;$(IncludePath) + + + $(SolutionDir)\..\include;C:\Boost\include\boost-1_54;$(IncludePath) + C:\Boost\lib;$(LibraryPath) + + + $(SolutionDir)\..\include;C:\Boost\include\boost-1_55;$(IncludePath) + false + + + + Level3 + Disabled + true + + + true + + + + + Level3 + Disabled + true + + + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + false + + + true + true + true + + + + + + + + \ No newline at end of file diff --git a/vs2013/unittests/unittests.vcxproj b/vs2013/unittests/unittests.vcxproj index 3c56f288..f8037e59 100644 --- a/vs2013/unittests/unittests.vcxproj +++ b/vs2013/unittests/unittests.vcxproj @@ -80,6 +80,7 @@ $(SolutionDir)\..\include;E:\Boost\include\boost-1_55;$(IncludePath) E:\Boost\lib\x64;$(LibraryPath) + true @@ -131,6 +132,7 @@ true true /bigobj %(AdditionalOptions) + true true