inout(char)[] todstr(inout(char)* cstr) pure nothrow
{
return cstr ? cstr[0 .. std.c.string.strlen(cstr)] : cstr[0 .. 0];
}
struct Data
{
char buffer[256] = void;
@property const(char)[] filename() const pure nothrow { return todstr(buffer.ptr); }
}
struct MyThing
{
private this(in Data* p)
{
filename = p.filename; // *** Uh oh! assigned a const(char)[] @property to a string! ***
}
string filename;
}