D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6832 - Can't test objects wrapped with alias this
Summary: Can't test objects wrapped with alias this
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: patch, rejects-valid
Depends on:
Blocks:
 
Reported: 2011-10-19 20:44 UTC by Andrej Mitrovic
Modified: 2011-11-15 21:23 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrej Mitrovic 2011-10-19 20:44:16 UTC
class Foo { }
struct Bar { Foo foo; alias foo this; }
void main()
{
    Bar bar;
    bar = new Foo;  // ok
    assert(bar !is null);  // ng
}
Comment 1 Andrej Mitrovic 2011-10-19 20:44:46 UTC
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*'