Support nogc_construct of struct with disabled postblit.#24
Merged
LunaTheFoxgirl merged 2 commits intoInochi2D:mainfrom Dec 4, 2025
Merged
Support nogc_construct of struct with disabled postblit.#24LunaTheFoxgirl merged 2 commits intoInochi2D:mainfrom
LunaTheFoxgirl merged 2 commits intoInochi2D:mainfrom
Conversation
Didn't work in the new placement new path.
Contributor
Author
|
Can repro CI failure with DMD 2.111 |
Contributor
Author
|
Sorry to ask, a git tag would one thing Dplug needs to depend on numem, since today all objects |
Member
|
Sure, will create a new tag in a bit. |
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.
This one is a bit tricky.
The issue it fix is "not being able to nogc_construct a disabled-postblit struct on DMDFE >= 2111" (eg: LDC 1.41.0)
Here the placement new will act directly on the referenced object (instead of relying on declaring a temp initialized T and assign).
HOWEVER
Calling emplace on uninitialized memory is considered UB by numem, but it does visibly happen in numem and the code I replaced was doing a .init initialization with
T tmp;.So out of desire to not break anything, initializeAt(dst); was added.
I checked in an uncommited test that placement new does NOT initialize memory.
I think "nogc_construct" contract should read:
nogc_constructon uninitialized object is UB" (though for now it works)nogc_constructon created object is illegal(EDIT: tests pass locally but yeah probably trickier than that)