You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/usr/src/d/vibe.d/utils/vibe/utils/dictionarylist.d(198): Error: cannot implicitly convert expression `this.get(key, delegate const(MyInterface)() => null)` of type `const(MyInterface)` to `inout(MyInterface)`
main.d(41): Error: template instance vibe.utils.dictionarylist.DictionaryList!(VariantN!32LU, true, 2LU, false).DictionaryList.get!(MyInterface) error instantiating
The same error occurs if the interface is changed to class, and if the class/interface isn't directly stored in req.context, but is part of a struct.
Expected behaviour: it should be possible to store class and interface references in HTTPServerRequest.context.
Currently-known workaround: specify the default argument with T.init explicltly.
interface MyInterface { }
void func(HTTPServerRequest req) {
auto intf = req.context.get!MyInterface("abc",
MyInterface.init); // <-- this works
}
I looked at the code and found comments mentioning a dmd bug and a bunch of overloads that supposedly works around said bug. However, the workaround doesn't seem to work for classes/interfaces.
The text was updated successfully, but these errors were encountered:
quickfur
changed the title
HTTPServerRequest.context.get cannot be instantiated with classes and interfaces
HTTPServerRequest.context.get cannot be used with classes and interfaces
Dec 14, 2017
Code:
Compiler output:
The same error occurs if the
interface
is changed toclass
, and if the class/interface isn't directly stored inreq.context
, but is part of astruct
.Expected behaviour: it should be possible to store class and interface references in
HTTPServerRequest.context
.Currently-known workaround: specify the default argument with
T.init
explicltly.I looked at the code and found comments mentioning a dmd bug and a bunch of overloads that supposedly works around said bug. However, the workaround doesn't seem to work for classes/interfaces.
The text was updated successfully, but these errors were encountered: