Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
/ druntime Public archive
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/core/internal/array/appending.d
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ template _d_arrayappendcTXImpl(Tarr : T[], T)
* Returns:
* The new value of `px`
* Bugs:
* This function template was ported from a much older runtime hook that bypassed safety,
* purity, and throwabilty checks. To prevent breaking existing code, this function template
* is temporarily declared `@trusted pure` until the implementation can be brought up to modern D expectations.
* This function template was ported from a much older runtime hook that bypassed safety,
* purity, and throwabilty checks. To prevent breaking existing code, this function template
* is temporarily declared `@trusted pure` until the implementation can be brought up to modern D expectations.
*/
ref Tarr _d_arrayappendcTX(return ref scope Tarr px, size_t n) @trusted pure nothrow
{
// needed for CTFE: https://github.com/dlang/druntime/pull/3870#issuecomment-1178800718
pragma(inline, false);
Comment on lines +39 to +40
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a DMD specific issue? LDC does not recognise pragma(inline, whatever); unless it is outside the function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the problem is DMD's front-end inliner. This is a specially recognized function for CTFE, and inlining the body into another function makes DMD not recognize it anymore.

version (D_TypeInfo)
{
auto ti = typeid(Tarr);
Expand Down