-
-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
document move constructor #3918
base: master
Are you sure you want to change the base?
Conversation
Thanks for your pull request, @WalterBright! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
DAutoTest doesn't like it because of the new
|
$(DDSUBLINK spec/function, function-default-args, default argument), | ||
followed by any number of parameters with default arguments.) | ||
|
||
$(LI Its first parameter is a $(B not) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$(LI Its first parameter is a $(B not) | |
$(LI Its first parameter is $(B not) a |
A a; | ||
a.arr = [1, 2]; | ||
|
||
A b = __rvalue(a); // move constructor gets called |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is __rvalue
implemented by the dmd pull?
in the following situations:) | ||
|
||
$(OL | ||
$(LI When an rvalue is used to initialize a variable:) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about A a = A();
- the RHS is an rvalue, but presumably the move constructor is not called?
--- | ||
) | ||
|
||
$(LI When a parameter is returned by value from a function and Named Returned Value Optimization (NRVO) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor tweak to match https://dlang.org/spec/glossary.html#nrvo.
$(LI When a parameter is returned by value from a function and Named Returned Value Optimization (NRVO) | |
$(LI When a parameter is returned by value from a function and Named Return Value Optimization (NRVO) |
$(OL | ||
$(LI When an rvalue is used to initialize a variable:) | ||
|
||
$(SPEC_RUNNABLE_EXAMPLE_RUN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the SPEC_RUNNABLE_EXAMPLE_ code needs to be COMMENT'd out to pass DAutoTest:
__stdin.d(3): Error: declaration expected, not `=`
$(H3 $(LNAME2 disable-move, Disabled Moving)) | ||
|
||
$(P Move constructor attributes work analogously to | ||
$(LINK2 disable-copy, Disabled Copying).) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$(LINK2 disable-copy, Disabled Copying).) | |
$(RELATIVE_LINK2 disable-copy, Disabled Copying).) |
$(H3 $(LNAME2 move-constructor-attributes, Move Constructor Attributes)) | ||
|
||
$(P Move constructor attributes work analogously to | ||
$(LINK2 copy-constructor-attributes, Copy Constructor Attributes).) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$(LINK2 copy-constructor-attributes, Copy Constructor Attributes).) | |
$(RELATIVE_LINK2 copy-constructor-attributes, Copy Constructor Attributes).) |
|
||
$(H3 $(LNAME2 disable-move, Disabled Moving)) | ||
|
||
$(P Move constructor attributes work analogously to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$(P Move constructor attributes work analogously to | |
$(P Disabling move construction works analogously to |
corresponding code PR: dlang/dmd#16876