diff --git a/OgreMain/include/OgreAssert.h b/OgreMain/include/OgreAssert.h index 2aede1c8cb..d88c8b6307 100644 --- a/OgreMain/include/OgreAssert.h +++ b/OgreMain/include/OgreAssert.h @@ -126,12 +126,10 @@ namespace Ogre # define OGRE_VERIFY_MSG( cond, msg, ... ) ( (void)0 ) #endif -#if __cplusplus >= 201103L +#if __cplusplus >= 201703L || defined( _MSVC_LANG ) && _MSVC_LANG >= 201703L +# define OGRE_STATIC_ASSERT( x ) static_assert( x ) +#else // C++11 # define OGRE_STATIC_ASSERT( x ) static_assert( x, # x ) -#else -# define OGRE_STATIC_ASSERT( x ) \ - typedef char OgreStaticAssert[( x ) ? 1 : -1]; \ - OGRE_UNUSED( OgreStaticAssert ); #endif #endif diff --git a/RenderSystems/Vulkan/src/OgreVulkanRenderSystem.cpp b/RenderSystems/Vulkan/src/OgreVulkanRenderSystem.cpp index 9e0f038a1e..e0580907d3 100644 --- a/RenderSystems/Vulkan/src/OgreVulkanRenderSystem.cpp +++ b/RenderSystems/Vulkan/src/OgreVulkanRenderSystem.cpp @@ -528,7 +528,7 @@ namespace Ogre //------------------------------------------------------------------------- void VulkanRenderSystem::savePipelineCache( DataStreamPtr stream ) const { - static_assert( sizeof( PipelineCachePrefixHeader ) == 48 ); + OGRE_STATIC_ASSERT( sizeof( PipelineCachePrefixHeader ) == 48 ); if( mActiveDevice->mPipelineCache ) { size_t size{}; @@ -559,7 +559,7 @@ namespace Ogre hdr.driverVersion = mActiveDevice->mDeviceProperties.driverVersion; hdr.driverABI = sizeof( void * ); memcpy( hdr.uuid, mActiveDevice->mDeviceProperties.pipelineCacheUUID, VK_UUID_SIZE ); - static_assert( VK_UUID_SIZE == 16 ); + OGRE_STATIC_ASSERT( VK_UUID_SIZE == 16 ); uint64 hashResult[2] = {}; OGRE_HASH128_FUNC( buf.data(), (int)buf.size(), IdString::Seed, hashResult );