D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6481 - composition with alias this doesn't work inside the struct
Summary: composition with alias this doesn't work inside the struct
Status: RESOLVED DUPLICATE of issue 2787
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2011-08-12 12:56 UTC by Trass3r
Modified: 2011-08-14 07:32 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Trass3r 2011-08-12 12:56:34 UTC
struct Memory
{
    int foo;
}
struct Image
{
    Memory sup;
    alias sup this;

	void bla()
	{
		foo = 1;
	}
}

$ dmd -c test.d 
DMD v2.054 DEBUG
test.d(12): Error: undefined identifier foo

Using this.foo = 1 fixes it.
Comment 1 Trass3r 2011-08-14 07:32:32 UTC

*** This issue has been marked as a duplicate of issue 2787 ***