Skip to content
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

Issue 9258 & 9404 & 9416 - fix regressions around opAssign #1585

Merged
merged 5 commits into from Jan 31, 2013

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented Jan 31, 2013

Issue 9258 - opAssign with base class triggers "identity assignment operator overload" error

This is just my mistake. "Identity opAssign" must receive just same type except type qualifiers.

Issue 9416 - [REG][2.060 -> 02.061] DMD eagerly instantiates template parameter-less opAssign

For the detection of identity opAssign, the occured errors in semantic should be gagged. But it had been incomplete. This is just a compiler implementation issue.

Issue 9404 - Nullable is unusable with 2.061

By merging #166, compiler started to recognize template opAssign. A critical feature for generating built-in opAssign is: "If identity opAssign is detected in a struct, it is used. If it not found, but the fields require member-wise assignment, builit-in opAssign is generated."
In here, essentially "user defined but not identity opAssigns" are unrelated. In the assignment operation, identity or not should be distinguished. I had completely misunderstand about this point.
Now, all test results from the combinations at test/runnable/assignable.d test6216a() changed to true.


Requires phobos change at the same time.

Now, user-defined but non identity opAssign is just ignored in identity assignment resolving.

For the identity assignment operation, following four operations might be defined by the compiler.

1. If a user-defined identity `opAssign` is defined, it is used.
2. If the struct has postbit constructor, "copy & swap" operation is used.
3. If member-wise assignment is necessary, it is used.
4. Otherwise, assignment possibility is calculated from bitwise assignable of whole members.

As a conclusion, except for the case where the members have disabled opAssign, identity assignment will succeed in almost cases.
Use same way with the built-in opAssign generation.
Merged similar tests by making them parameterize.
@9rnsr
Copy link
Contributor Author

9rnsr commented Jan 31, 2013

Requires phobos pull: dlang/phobos#1105

WalterBright added a commit that referenced this pull request Jan 31, 2013
Issue 9258 & 9404 & 9416 - fix regressions around opAssign
@WalterBright WalterBright merged commit b94fd3b into dlang:master Jan 31, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants