What is this malarky?

https://run.dlang.io/is/S42EBb

"onlineapp.d(16): Error: address of variable this assigned to this with longer lifetime"

```d
import std.stdio;

struct SmallString
{
    char[24] small;
    char[] data;

    @disable this();

    this(scope const(char)[] s) @safe
    {
        if (s.length < small.length)
        {
            small[0 .. s.length] = s[];
            small[s.length] = 0;
            data = small[0 .. s.length];
        }
        else
        {
            assert(0, "Compilation failed before I wrote this.");
        }
    }
}

void main()
{
    writeln("Hello D");
}
```

Reply via email to