D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 8080 - 'alias this' causes toString to be shadowed by aliased object
Summary: 'alias this' causes toString to be shadowed by aliased object
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 regression
Assignee: No Owner
URL:
Keywords: pull, wrong-code
Depends on:
Blocks:
 
Reported: 2012-05-10 13:00 UTC by hsteoh
Modified: 2012-07-25 13:37 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description hsteoh 2012-05-10 13:00:39 UTC
Code:
        struct S {
                short[4] data;
                alias this data;

                string toString() { ... }
        }
        ...
        S s;
        writeln(to!string(s));

In dmd 2.059 (I believe) and earlier, this calls S.toString(). However,
in git dmd, this calls data.toString() instead.
Comment 2 github-bugzilla 2012-05-22 12:40:09 UTC
Commit pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/40de9e601b3d80189d9e8b1f5b32d8b00270f610
fix Issue 8080 - 'alias this' causes toString to be shadowed by aliased object