Skip to content

Fix stale ODR-use state before lexed inline methods#8324

Open
AnastaZIuk wants to merge 1 commit intomicrosoft:mainfrom
Devsh-Graphics-Programming:fix_ex40_assert_2026_04_01
Open

Fix stale ODR-use state before lexed inline methods#8324
AnastaZIuk wants to merge 1 commit intomicrosoft:mainfrom
Devsh-Graphics-Programming:fix_ex40_assert_2026_04_01

Conversation

@AnastaZIuk
Copy link
Copy Markdown
Contributor

Summary

This clears stale delayed ODR-use bookkeeping before starting a lexed inline method body.

It also adds a small SPIR-V regression test for the same parser path.

Root cause

The missing cleanup is in ParseLexedMethodDef, which was introduced in 6ee4074a4.

That path enters ActOnStartOfFunctionDef(...) without first calling CleanupVarDeclMarking().

HLSL constant-expression references inside declarations such as [[vk::binding(Bindings::Mask, SessionDSIndex)]] can leave entries in MaybeODRUseExprs.

When the next lexed inline method is parsed, ActOnFinishFunctionBody(...) trips the debug invariant:

Leftover expressions for odr-use checking

Impact

This crashes assert-enabled DXC builds on valid HLSL.

Public release-like builds usually compile the same source because assertions are off, so the bug is masked rather than absent.

Repros

Both CE links use the public dxc_trunk build, so they compile there because that build does not expose the local debug assert path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

1 participant