D-Programming-Language/phobos — pull request #1103 by monarchdodra (2013-01-29 16:36:43+00:00)
Title: Fix Nullalble to support self assignment

See also:
http://d.puremagic.com/issues/show_bug.cgi?id=9404

Basically, `Nullable[Flavor]` was not self assignable. *Attempts* to do self assignement would compile, because it extracts the value value via `get`, and then uses opAssign(T value). This can throw an exception if the other nullable is null though.

The problem with this is that it makes `this(this) and `opAssign` inconsistent (postblit never throws). This makes things particularly tricky if you start nesting a Nullable inside a struct:

```D
struct S1
{
Nullable!int ni;
//default S1 s1 = S1(myNullable); works
//default s1 = s2; works
}

struct S2
{
Nullable!int ni;
this(Nullable!int n)
{ni = n;} //Throws
void opAssign(S2 other)
{ni = other.ni;} //Throws
}
```

----
This pull simply give all Nullables the function `void opAssign()(typeof(this) other)`. This makes the current nullable a copy of other. This can leave the current nullable in the null state.

Also in this pull:
* Remove 4424 workaround
* Give failed enforcements error messages
* Workaround for 9416