digitalmars.D.bugs - [Issue 16082] New: Can't access alias this member with same name as
- via Digitalmars-d-bugs (41/41) May 27 2016 https://issues.dlang.org/show_bug.cgi?id=16082
https://issues.dlang.org/show_bug.cgi?id=16082 Issue ID: 16082 Summary: Can't access alias this member with same name as module Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: jbc.engelen gmail.com The following code does not compile ```D module modulename; struct S { struct Inner { int any_name_but_modulename; int modulename; } Inner inner; alias inner this; auto works() { return any_name_but_modulename; } auto fails() { return modulename; // Line 20 } } ``` and fails with: bug.d(20): Error: modulename is not an expression The problem is that S.Inner.modulename has the same name as the module. Tested with DMD 2.067, DMD2.070.2, and DMD2.071.0. They all fail. --
May 27 2016