Bug 6832 – Can't test objects wrapped with alias this
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-10-19T20:44:00Z
Last change time
2011-11-15T21:23:08Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
andrej.mitrovich
Comments
Comment #0 by andrej.mitrovich — 2011-10-19T20:44:16Z
class Foo { }
struct Bar { Foo foo; alias foo this; }
void main()
{
Bar bar;
bar = new Foo; // ok
assert(bar !is null); // ng
}
Comment #1 by andrej.mitrovich — 2011-10-19T20:44:46Z
test.d(9): Error: incompatible types for ((bar) !is (null)): 'Bar' and 'void*'(In reply to comment #0)
> class Foo { }
> struct Bar { Foo foo; alias foo this; }
> void main()
> {
> Bar bar;
> bar = new Foo; // ok
> assert(bar !is null); // ng
> }
Error: incompatible types for ((bar) !is (null)): 'Bar' and 'void*'