Skip to content

Fix DeclUnloader crash with UsingShadowDecl during undo#566

Open
0xeb wants to merge 1 commit intoroot-project:masterfrom
lallouslab:fix/declunloader-usingshadowdecl
Open

Fix DeclUnloader crash with UsingShadowDecl during undo#566
0xeb wants to merge 1 commit intoroot-project:masterfrom
lallouslab:fix/declunloader-usingshadowdecl

Conversation

@0xeb
Copy link

@0xeb 0xeb commented Mar 23, 2026

Summary

When unloading transactions that contain implicit template instantiations with using-shadow declarations, the DeclUnloader crashes because the introducer's shadow chain may reference already-freed declarations.

Fix: Enable VisitRedeclarable for UsingShadowDecl (was FIXME'd out for newer Clang) and guard removeShadowDecl() with null/containment checks to prevent use-after-free.

Test plan

  • Without this fix, undo() on code with using declarations crashes
  • With the fix, undo/rollback tests pass
  • Tested on ARM64 Linux and Windows x64
  • Note: this patch is optional in our test suite — the crash only manifests with specific using-shadow patterns

When unloading transactions that contain implicit template
instantiations with using-shadow declarations, the DeclUnloader
crashes because the introducer's shadow chain may reference
already-freed declarations.

Fix: enable VisitRedeclarable for UsingShadowDecl (was FIXME'd out
for newer Clang) and guard removeShadowDecl() with null/containment
checks to prevent use-after-free.
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.

1 participant