[Issue 19476] New: explicit mixin template function call results in recursive call instead
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Dec 11 13:15:23 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=19476
Issue ID: 19476
Summary: explicit mixin template function call results in
recursive call instead
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: dkorpel at live.nl
Context at https://forum.dlang.org/post/bopolkyyykbrfjymhcjb@forum.dlang.org
Code:
```
mixin template operators() {
S opBinary(string op, T)(T rhs) {
return rhs;
}
}
struct S {
mixin operators ops;
S opBinary(string op, T)(T a) {
return ops.opBinary!op(a);
}
}
void main() {
S.init.opBinary!"+"(S.init);
}
```
Expected:
The call `ops.opBinary` to refer to the mixin template.
Actual:
A recursive call is made resulting in stack overflow.
When doing `alias opBinary = ops.opBinary` before the call it does work
correctly.
--
More information about the Digitalmars-d-bugs
mailing list