Comment #0 by shammah.chancellor — 2013-11-09T12:23:37Z
import std.stdio;
class Hmm
{
int Hmmor;
}
class A {
Hmm bar;
}
class Foo : A {
this( Hmm _bar) pure
{
bar = _bar;
}
}
void sendA(immutable A input)
{
}
void sendFoo(immutable Foo input)
{
}
void main()
{
auto wat = new Hmm();
sendA( new Foo(wat));
}
Comment #1 by andrej.mitrovich — 2013-11-09T13:27:13Z
Comment #2 by shammah.chancellor — 2013-11-09T20:34:29Z
In this case it's a bug, because I have a non-unique non-immutable pointer to Bar still in main(). I removed it by accident, but sendFoo( new Foo() ); is still an error.
Comment #3 by k.hara.pg — 2013-11-12T06:17:20Z
Interestingly it is not related to unique object construction.
Reduced test case:
class A {}
class Foo : A {}
void main()
{
immutable A a = new Foo();
}
Compiler fix:
https://github.com/D-Programming-Language/dmd/pull/2749
Comment #4 by github-bugzilla — 2013-11-12T19:43:23Z