Bug 2450 – Error using operators from named template mixin
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2008-11-12T22:31:02Z
Last change time
2021-05-30T03:01:43Z
Keywords
pull, rejects-valid
Assigned to
No Owner
Creator
Jordan Miner
Comments
Comment #0 by jminer7 — 2008-11-12T22:31:02Z
template Event() {
void opCall() { }
void opAddAssign(int i) { }
}
class Button {
mixin Event clicked;
void func() {
clicked.opCall(); // works
this.clicked(); // works
// Error: function expected before (), not mixin Event!() clicked; of type void
clicked();
// Error: mixin 'Event!()' is not a variable
clicked += 7;
}
}
Tested with DMD v1.033.
A workaround is shown of using "this." before the name of the mixin, but that could get annoying.
Comment #1 by dlang-bot — 2019-09-13T11:24:44Z
@RazvanN7 created dlang/dmd pull request #10406 "Fix Issue 2450 - Error using operators from named template mixin" fixing this issue:
- Fix Issue 2450 - Error using operators from named template mixin
https://github.com/dlang/dmd/pull/10406
Comment #2 by dlang-bot — 2019-09-14T11:48:12Z
dlang/dmd pull request #10406 "Fix Issue 2450 - Error using operators from named template mixin" was merged into master:
- dd79b0cb45ef8686978f6b5896cb829af8120ff7 by RazvanN7:
Fix Issue 2450 - Error using operators from named template mixin
https://github.com/dlang/dmd/pull/10406
Comment #3 by dlang-bot — 2021-05-21T05:08:52Z
dlang/dmd pull request #12542 "Fix Issue 2450 - Error using operators from named template mixin (version 2)" was merged into stable:
- b071e9d04e8db0612d6c3350a6383d7e1ae0eecc by Boris Carvajal:
Fix Issue 2450 - Error using operators from named template mixin (version 2)
https://github.com/dlang/dmd/pull/12542
Comment #4 by dlang-bot — 2021-05-30T03:01:43Z
dlang/dmd pull request #12600 "merge stable" was merged into master:
- 79a6f7cf9d604eea33b072a9ab30170daeeda696 by Boris Carvajal:
Fix Issue 2450 - Error using operators from named template mixin (version 2)
https://github.com/dlang/dmd/pull/12600