Bug 20866 – Wrong overload function call with "scope const"

Status
NEW
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-05-26T14:06:46Z
Last change time
2024-12-13T19:08:51Z
Assigned to
No Owner
Creator
apham
Moved to GitHub: dmd#19709 →

Comments

Comment #0 by apz28 — 2020-05-26T14:06:46Z
struct S { public: this(string s) { this.s = s; } // Remove 'const' will make it work void x(scope const S v) { } // Recursive calling itself because of alias value this - stack overflow private static int xCounter = 0; void x(string v) { assert(xCounter == 0); xCounter++; scope (exit) xCounter--; x(S(v)); } @property string value() { return s; } alias value this; private: string s; } void main() { S s = S("a"); s.x("b"); }
Comment #1 by robert.schadek — 2024-12-13T19:08:51Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19709 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB