D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 18588 - alias this inside named mixin template
Summary: alias this inside named mixin template
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P3 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-10 16:59 UTC by Simen Kjaeraas
Modified: 2024-12-13 18:57 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 Simen Kjaeraas 2018-03-10 16:59:36 UTC
struct S {
    mixin foo!() bar;
}

template foo() {
    int n;
    alias n this;
}

unittest {
    int n = S.init;
}

The alias this is inside a named member of S, and it is counterintuitive that it affects S.
Comment 1 dlangBugzillaToGithub 2024-12-13 18:57:46 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/19407

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB