Bug 8906 – attribute inference failure with opAssign and alias this

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-10-29T02:36:00Z
Last change time
2012-11-08T09:46:44Z
Keywords
rejects-valid
Assigned to
nobody
Creator
nilsbossung
Depends on
6356

Comments

Comment #0 by nilsbossung — 2012-10-29T02:36:33Z
--- cat > test.d <<CODE struct S() { // needs to be a template to trigger the bug void impl()(int) {} // template for purity inference // unused, needed to trigger the bug: int i; alias i this; alias impl opAssign; } pure void p() { S!() s; s.impl(42); } alias S!() Dummy; // unused, needed to trigger the bug CODE dmd -c -o- test.d --- test.d(12): Error: pure function 'p' cannot call impure function 'impl' --- Looks like alias this and opAssign clash somehow. Works with 2.060. Fails since this commit: https://github.com/D-Programming-Language/dmd/commit/9ee798f73a2f7765a68bbe8f40ff292f551dab72
Comment #1 by nilsbossung — 2012-10-29T21:49:50Z
Inference of nothrow and @safe fails, too.
Comment #2 by k.hara.pg — 2012-11-03T05:45:24Z
> Works with 2.060. Fails since this commit: > https://github.com/D-Programming-Language/dmd/commit/9ee798f73a2f7765a68bbe8f40ff292f551dab72 The root cause is bug 6356, and the commit just exposed the issue.
Comment #3 by k.hara.pg — 2012-11-08T09:46:44Z
By fixing issue 6356, the code compiles correctly.