Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Fix 19783 - Fail to emplace struct with betterC #3454

Merged
merged 1 commit into from
Apr 29, 2021

Conversation

MoonlightSentinel
Copy link
Contributor

Defining the helper function as a template ensures that it is available when not linking druntime.

(pragma(inline, true) didn't work)

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @MoonlightSentinel! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Auto-close Bugzilla Severity Description
19783 normal Fail to emplace struct with betterC

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + druntime#3454"

@dlang-bot dlang-bot added the Bug Fix Include reference to corresponding bugzilla issue label Apr 27, 2021
@kinke
Copy link
Contributor

kinke commented Apr 27, 2021

Templatizing it isn't actually enough to guarantee that it's emitted (template culling, needsCodegen()), but yeah, it works in most cases. I'm absolutely no friend of these dummy templates; I don't want to end up with a templates-only druntime/Phobos (STL) just to allow people to use druntime/Phobos stuff with -betterC. People can e.g. still link druntime manually with -betterC - that'll most likely result in some bloat, unused TypeInfos and ModuleInfos etc., but still, missing symbols are resolved, and unless the called functions require a properly initialized druntime (module ctors etc.), it actually works.

Defining the helper function as a template ensures that it is available
when not linking druntime.

(`pragma(inline, true)` didn't work)
@MoonlightSentinel
Copy link
Contributor Author

Fair enough. I've inlined those asserts because the helper function was only used in two places and this save some unnecessary template instantiations.

@dlang-bot dlang-bot merged commit f04932f into dlang:master Apr 29, 2021
@MoonlightSentinel MoonlightSentinel deleted the betterc-emplace-struct branch June 22, 2021 09:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Fix Include reference to corresponding bugzilla issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants