[Issue 5365] Regression (2.051) alias this causes segfault
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Dec 23 03:53:52 PST 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5365
--- Comment #2 from Max Samukha <samukha at voliacable.com> 2010-12-23 03:51:52 PST ---
(In reply to comment #1)
> It works with DMD 2.051 if I replace this line of the main():
> IFactory f = new A;
>
> With:
> A f = new A;
We still need the implicit cast to work correctly. For example, we cannot pass
an A to a function taking an IFactory:
void bar(IFactory f)
{
f.foo(); // segfault
}
auto a = new A;
bar(a);
Here is a simplified test-case:
class B
{
}
class A
{
B _b;
this()
{
_b = new B;
}
B b()
{
return _b;
}
alias b this;
}
void main()
{
auto a = new A;
B b = a; // b is null
assert(a._b is b); // fails
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list