Trying to get dip1000 flag in use. I have this error:

Error: returning Optional(null, false).this(value) escapes a reference to parameter value, perhaps annotate with return

in this function:

public auto some(T)(auto ref T value) {
    return Optional!T(value); // <-- error on this line
}

And it's instantiated from here:

static Optional!T fromRepresentation(Json value) {
  if (value == Json.undefined) {
    return no!T;
  }
return some(deserializeJson!T(value)); // <-- instantiated from here
}

I put the qualifier "return" on the parameter to some, but did nothing. And I put it on Optional.this() as well, but I'm not sure where I'm supposed to put it.

The constructor for Optional takes an auto ref T ... I'm not sure that makes sense. Does it make sense to take a constructor parameter that is copied in to the struct by auto ref if you're not calling .move on it explicitly?

And as for vibe-d, I get this when compiling with dip1000:

Also, vibe-d gives me this: ../../../.dub/packages/vibe-core-1.6.2/vibe-core/source/vibe/internal/traits.d(391,2): Error: static assert: "FileStream does not implement method "read" of type @safe ulong(scope ubyte[] dst, IOMode mode)"

Has anyone seen that or used vibed with dip1000?

Reply via email to