D-Programming-Language/phobos — pull request #2045 by monarchdodra (2014-03-24 10:22:34+00:00)
Title: Fix Appender constructor signature

The first of about 4-5 fixes in Appender.

This fixes a type unsafe constructor in `Appender`, that allowed breaking the type system, as such:

```D
void main() @safe
{
char[] buf;
string s = Appender!string(buf).data; //Oops!
}
```
Long story short: For type correctness, the *only* input that `Appender!(T[])` can accept as an initial buffer, is `T[]`, and not `Unqual!T[]`.

This bug only affected Appender implementations that had const in them anyways. I had to add a temporary `this(typeof(null))` overload because of ambiguity. I also just made the constructor trusted, instead of having 3 different trusted lambdas, especially since there is nothing unsafe in the function.

The good news is that *no-one* in phobos used the constructor wrong, so we can hope this will have low impact, and we can remove the deprecated constructor quickly.