Comment #0 by bearophile_hugs — 2010-11-21T16:39:57Z
This program looks correct:
import std.typecons: Rebindable;
const class Foo {}
pure nothrow void bar() {
Rebindable!Foo f = new Foo;
}
void main() {}
But DMD 2.050 shows the errors:
test.d(4): Error: pure function 'bar' cannot call impure function 'this'
test.d(3): Error: function test3.bar 'bar' is nothrow yet may throw
(I don't know if this is possible in all cases, like when Rebindable is used on a struct with a nonpure postblit. But with class references I think this is possible).
Comment #1 by k.hara.pg — 2011-09-09T07:59:31Z
Maybe this issue was fixed by pure nothrow inference feature.
In 2.055, that code can compile.