[Issue 17953] inout-like mechanism to infer function attributes from callback attributes
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Oct 31 16:58:51 UTC 2017
https://issues.dlang.org/show_bug.cgi?id=17953
--- Comment #1 from anonymous4 <dfj1esp02 at sneakemail.com> ---
Apparently even templates don't help here much:
---
import std.typecons:Nullable;
Nullable!V convert(T,V)(Nullable!T v, scope V delegate(T) c)
{
if(v.isNull)return Nullable!V();
return Nullable!V(c(v.get()));
}
void f() pure
{
Nullable!long v;
Nullable!int v1=v.convert!(long,int)((a){ return cast(int)a; });
}
---
Error: pure function 'f' cannot call impure function 'convert!(long,
int).convert'
--
More information about the Digitalmars-d-bugs
mailing list