Skip to content

Conversation

WalterBright
Copy link
Member

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @WalterBright!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

@rikkimax rikkimax added the 72h no objection -> merge The PR will be merged if there are no objections raised. label Jan 14, 2025
@rikkimax
Copy link
Contributor

If it is not appropriate to merge in 72 hours, feel free to take off the tag.

@WalterBright
Copy link
Member Author

I cannot merge it anyway until the dmd PR is merged, as otherwise the code examples will not work.

@rikkimax rikkimax removed the 72h no objection -> merge The PR will be merged if there are no objections raised. label Jan 14, 2025
@ntrel ntrel added this to the 2.111.0 milestone Mar 10, 2025
@pbackus
Copy link
Contributor

pbackus commented Sep 11, 2025

@WalterBright Is this ready to be merged now?

are designed to be on the GC heap. The size of the associative array allocated is determined
by the runtime library, and cannot be set by the user.)

$(P The use of $(PlacementExpression) is not allowed in `@safe` code.)
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix ddoc macro error

Suggested change
$(P The use of $(PlacementExpression) is not allowed in `@safe` code.)
$(P The use of $(I PlacementExpression) is not allowed in `@safe` code.)

}
-----------

$(H4 $(LNAME2 PlacementExpression, Placement Expression))
Copy link
Contributor

Choose a reason for hiding this comment

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

PlacementExpression is already a GNAME anchor above.

Suggested change
$(H4 $(LNAME2 PlacementExpression, Placement Expression))
$(H4 $(LNAME2 placement-expression, Placement Expression))

$(P $(I NewExpression)s allocate memory on the
$(DDLINK spec/garbage, Garbage Collection, garbage
collected) heap by default.
collected) heap unless there is a $(RELATIVE_LINK2 PlacementExpression, PlacementExpression).
Copy link
Contributor

Choose a reason for hiding this comment

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

Change to match subheading anchor fix below:

Suggested change
collected) heap unless there is a $(RELATIVE_LINK2 PlacementExpression, PlacementExpression).
collected) heap unless there is a $(RELATIVE_LINK2 placement-expression, *PlacementExpression*).

---
)

(If Type is a class, the $(I PlacementExpression) must produce an lvalue of type that is of a
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
(If Type is a class, the $(I PlacementExpression) must produce an lvalue of type that is of a
(If Type is a class, the $(I PlacementExpression) must produce an lvalue of a type that is of a


void main()
{
void[__traits(classInstanceSize, C)] k;
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix "Error: variable onlineapp.main.k of type void[24] does not have a default initializer"

Suggested change
void[__traits(classInstanceSize, C)] k;
void[__traits(classInstanceSize, C)] k = void;

void[__traits(classInstanceSize, C)] k;
C c = new(k) C;
assert(c.j == 4);
assert(cast(void*)c == cast(void*)k.ptr);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the second cast isn't needed.

Suggested change
assert(cast(void*)c == cast(void*)k.ptr);
assert(cast(void*) c == k.ptr);

$(P The lifetime of the object presented as an lvalue ends with the execution of the $(I NewExpression),
and a new lifetime of the placed object starts after the execution.)

$(SPEC_RUNNABLE_EXAMPLE_COMPILE
Copy link
Contributor

Choose a reason for hiding this comment

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

All 3 examples should be SPEC_RUNNABLE_EXAMPLE_RUN, so the auto-tester checks the asserts.

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

Successfully merging this pull request may close these issues.

5 participants