Skip to content

Fix: no-enum-constexpr-conversion compilation error of DX12 backend with clang-cl#696

Merged
TheMostDiligent merged 2 commits intoDiligentGraphics:masterfrom
JKot-Coder:pr1
Aug 14, 2025
Merged

Fix: no-enum-constexpr-conversion compilation error of DX12 backend with clang-cl#696
TheMostDiligent merged 2 commits intoDiligentGraphics:masterfrom
JKot-Coder:pr1

Conversation

@JKot-Coder
Copy link
Copy Markdown
Contributor

Summary

This PR removes the -Wno-enum-constexpr-conversion compiler flag from
the D3D12 graphics engine build. The original warning suppression is no
longer necessary because:

  1. Clang now treats the conversion from an invalid enum value in a
    constexpr context as an error that cannot be suppressed
    (-Wenum-constexpr-conversion should be a hard error, not a downgradable error llvm/llvm-project#59036).

  2. The code in RootParamsManager.cpp has been updated: the
    InvalidDescriptorRangeType is now a const instead of constexpr,
    making the conversion from -1 valid.

Changes

  • Removed -Wno-enum-constexpr-conversion from Clang compile options.
  • Changed InvalidDescriptorRangeType from constexpr to const.
  • No longer requires suppression of the enum conversion warning.

This makes the code compatible with newer Clang versions and removes
unnecessary warning suppressions.

…ith clang-cl

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.
@TheMostDiligent TheMostDiligent merged commit c4a98bd into DiligentGraphics:master Aug 14, 2025
37 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants