Ref / NotNull struct
Namespace
rswhite4 at googlemail.com
Sun May 6 09:23:58 PDT 2012
I found an error: if you have something like this
[code]
void const_ref_foo(const Ref!(Foo) rf) {
write("Const: ");
rf.say();
}
[/code]
and call it with
[code]
Foo f1 = new Foo();
const_ref_foo(f1);
[/code]
You get this error:
ref_test.d(101): Error: template
ref_test.Ref!(Foo).Ref.Proxy!(_obj).opDispatch!
("say").opDispatch does not match any function template
declaration
D:\D\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(2842):
Error: template ref
_test.Ref!(Foo).Ref.Proxy!(_obj).opDispatch!("say").opDispatch(this
X,Args...) c
annot deduce template function from argument types !()()
To avoid this you must change line 2842 in std.typecons from
[code]
auto ref opDispatch(this X, Args...)(Args args) { return
mixin("a."~name~"(args)"); }
[/code]
in
[code]
auto ref opDispatch(this X, Args...)(Args args) inout { return
mixin("a."~name~"(args)"); }
[/code]
It seems to be a bug. But must i create a new bug report for
something like this?
More information about the Digitalmars-d-learn
mailing list