December 11, 2018 [Issue 19476] New: explicit mixin template function call results in recursive call instead | ||||
---|---|---|---|---|
| ||||
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@puremagic.com Reporter: dkorpel@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. -- |
Copyright © 1999-2021 by the D Language Foundation