Skip to content

Commit c4a98bd

Browse files
Fix no-enum-constexpr-conversion compilation error in DX12 backend with clang-cl (#696)
The warning suppression -Wno-enum-constexpr-conversion no longer works on recent Clang versions because the warning it used to suppress has been promoted to an error that cannot be disabled (see llvm/llvm-project#59036). Also, the previous error in RootParamsManager.cpp was due to converting -1 to a D3D12_DESCRIPTOR_RANGE_TYPE enum in a constexpr context. Clang rejects this, but it allows the conversion for a regular const. The code has been updated to use a const instead of constexpr, making the conversion valid. Since the original issue that motivated the warning suppression no longer applies, we can safely remove -Wno-enum-constexpr-conversion. Co-authored-by: Assiduous <[email protected]>
1 parent 44ed712 commit c4a98bd

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,6 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
486486
INTERFACE
487487
-Wno-microsoft-exception-spec
488488
-Wno-tautological-constant-out-of-range-compare
489-
-Wno-enum-constexpr-conversion
490489
)
491490
elseif (PLATFORM_APPLE)
492491
# Allow unavailable API warnings not being errors as they tend to randomly

Graphics/GraphicsEngineD3D12/src/RootParamsManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace Diligent
3939
namespace
4040
{
4141

42-
constexpr D3D12_DESCRIPTOR_RANGE_TYPE InvalidDescriptorRangeType = static_cast<D3D12_DESCRIPTOR_RANGE_TYPE>(-1);
42+
const D3D12_DESCRIPTOR_RANGE_TYPE InvalidDescriptorRangeType = static_cast<D3D12_DESCRIPTOR_RANGE_TYPE>(-1);
4343

4444
#ifdef DILIGENT_DEBUG
4545
void DbgValidateD3D12RootTable(const D3D12_ROOT_DESCRIPTOR_TABLE& d3d12Tbl)

0 commit comments

Comments
 (0)