Fix clang errors blocking PCH compile and remaining Clang errors#58
Merged
Merged
Conversation
…te lookups
Fixes the clang-cl errors that surface when building D3D11On12 under USE_CLANG=1.
MSVC accepts all of these forms; clang strictly enforces the standard. Behavior
on MSVC is byte-identical after the changes.
Three patterns are fixed:
* Pattern A - `static constexpr` -> `static const` on lookup arrays whose
initializers are not core constant expressions (`(EnumType)<out-of-range-int>`
casts).
- include/VideoTranslate.hpp:86 (`VideoDecodeArgumentType::map`)
- src/device.cpp:34 (local `D3D12_FORMAT_SUPPORT1_CAPTURE`)
* Pattern B - eliminate the partial-specialization ambiguity in
`InitializeDeferredHandle<>` by forcing the 5+-arg specialization to require
at least one extra arg (parameter pack must be non-empty), so the 4-arg case
is unambiguously handled by the existing 4-arg partial specialization.
- include/DeviceChild.hpp:50-57
* Pattern C - insert the `template` keyword on dependent-template-name calls in
the `FillContextDDIs<TDevice>` function template, so clang parses the `<` as
the start of a template-id rather than as less-than.
- src/device.cpp:358-391 (30 sites: SetShader, SetShaderWithIfaces,
SetShaderResources, SetConstantBuffers, SetSamplers, six shader stages each)
Validated against an OS enlistment by building
onecoreuap\windows\DirectX\dxg\d3d11\d3d11on12 (24 files compiled, 0 errors)
and the sibling onecoreuap\windows\DirectX\dxg\d3d11\D3D11On12Internal (6 files,
0 errors) under USE_CLANG=1, plus an MSVC build at the same scope (49 files,
0 errors) to confirm no regression.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…te lookups
Fixes the clang-cl errors that surface when building D3D11On12 under USE_CLANG=1.
MSVC accepts all of these forms; clang strictly enforces the standard. Behavior
on MSVC is byte-identical after the changes.
Three patterns are fixed:
* Pattern A - `static constexpr` -> `static const` on lookup arrays whose
initializers are not core constant expressions (`(EnumType)<out-of-range-int>`
casts).
- include/VideoTranslate.hpp:86 (`VideoDecodeArgumentType::map`)
- src/device.cpp:34 (local `D3D12_FORMAT_SUPPORT1_CAPTURE`)
* Pattern B - eliminate the partial-specialization ambiguity in
`InitializeDeferredHandle<>` by forcing the 5+-arg specialization to require
the trailing shader IO signatures pointer. The 4-arg form (which only
pfnCreateComputeShader hits, since Compute is the only shader stage without
an IO signatures argument) is then unambiguously handled by the existing
4-arg partial specialization, whose Initialize body for that instantiation
produces the same memory write.
- include/DeviceChild.hpp:50-57
* Pattern C - insert the `template` keyword on dependent-template-name calls in
the `FillContextDDIs<TDevice>` function template, so clang parses the `<` as
the start of a template-id rather than as less-than.
- src/device.cpp:358-391 (30 sites: SetShader, SetShaderWithIfaces,
SetShaderResources, SetConstantBuffers, SetSamplers, six shader stages each)
Validated against an OS enlistment by building
onecoreuap\windows\DirectX\dxg\d3d11\d3d11on12 (24 files compiled, 0 errors)
and the sibling onecoreuap\windows\DirectX\dxg\d3d11\D3D11On12Internal (6 files,
0 errors) under USE_CLANG=1, plus an MSVC build at the same scope (49 files,
0 errors) to confirm no regression.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
winstliu
approved these changes
Jun 12, 2026
jenatali
approved these changes
Jun 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix all Clang errors with 3 patterns below.
Pattern A —
static constexpr→static conston arrays whose initializers are not constant expressions (2 sites)Error message:
error : constexpr variable 'map' must be initialized by a constant expressionFix: Casting an integer to an unfixed enum where the result lies outside the enum's value range (e.g.
(EnumType)-1for an unsigned-underlying enum) is not a core constant expression. Demotingconstexprtoconstdrops the strict constant-evaluation requirement; both arrays are only used at runtime, so nothing depended on their constexpr-ness during compile time.Pattern B — disambiguate
InitializeDeferredHandle<>partial specializations (1 site)Error message:
error: ambiguous partial specializations of 'InitializeDeferredHandle<void (*)(D3D10DDI_HDEVICE, const unsigned int *, D3D10DDI_HSHADER, D3D10DDI_HRTSHADER)>'Fix: The
TArgs...of the updatedInitializeDeferredHandleis allowed to be empty, in which case its signature can collapse to the 4-arg form(HDEVICE, const UINT*, HSHADER, HRTSHADER)— which also matches the 1st 4-arg partial specializationInitializeDeferredHandle<void(*)(HDEVICE, TArgs, THandle, TRTHandle)>forPopulateDeferredShaderInit(m_pDDITable->pfnCreateComputeShader). Fix by adding one extra arg (TSignature) to exclude the 4-arg case from this specialization, and the 4-arg case is then unambiguously handled by the 1st specialization.Pattern C — insert
templatekeyword on dependent-template-name calls (30 sites)Error message:
error : expected expressionFix: In Clang, when a dependent name is followed by
<and is intended as a template-id, it must be preceded by thetemplatekeyword — otherwise the compiler parses<as the less-than operator and reportserror: expected expression.Validation
Local build for both Clang and MSVC build pass.