On Tuesday, 8 July 2014 at 13:07:57 UTC, Meta wrote:
On Tuesday, 8 July 2014 at 12:42:44 UTC, NCrashed wrote:
Oops, I forgot shared at new. But the major issue is that
doesn't fix the problem:
```
import std.range;
class A {}
InputRange!(shared A) foo()
{
return [new shared A].inputRangeObject;
}
void bar()
{
auto res = foo.array;
}
void main() {}
```
Output:
```
/usr/include/dmd/phobos/std/conv.d(3914): Error: cannot
implicitly convert expression (arg) of type shared(A) to app.A
/usr/include/dmd/phobos/std/array.d(2476): Error: template
instance
std.conv.emplaceRef!(shared(A)).emplaceRef!(shared(A)) error
instantiating
/usr/include/dmd/phobos/std/array.d(64): instantiated
from here: put!(shared(A))
source/app.d(12): instantiated from here:
array!(InputRange!(shared(A)))
```
Hmmm, it worked when I compiled it on Dpaste, so you must be
using a different compiler. There were some changes to shared
in the current 2.066 beta, so that may be the cause. Somebody
more experienced with shared than me will have to answer.
I appreciate you help, the error smells like a bug. That compiles
on dmd 2.065, but I am testing new dmd 2.066-b1 to not suddenly
get dozens of such errors when it becomes a release.