← Back to index
|
Original Bugzilla link
Bug 5856 – overloading on const doesn't work for operator overload
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-04-18T13:42:00Z
Last change time
2011-06-17T22:38:48Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
k.hara.pg
Attachments
ID
Filename
Summary
Content-Type
Size
949
test.d
testcase
application/octet-stream
5645
Comments
Comment #0
by k.hara.pg — 2011-04-18T13:42:03Z
import std.stdio; struct X { void f() { writeln("X.f mutable"); } void f() const { writeln("X.f const"); } void g()() { writeln("X.g mutable"); } void g()() const { writeln("X.g const"); } void opOpAssign(string op)(int n) { writeln("X+= mutable"); } void opOpAssign(string op)(int n) const { writeln("X+= const"); } } void main() { X xm; xm.f(); // prints "X.f mutable" xm.g(); // prints "X.g mutable" xm += 10; // should print "X+= mutable" (1) const(X) xc; xc.f(); // prints "X.f const" xc.g(); // prints "X.g const" xc += 10; // should print "X+= const" (2) } Compiling this code occurs ambiguous error on line (1) and (2). I think issue 3810 is related.
Comment #1
by k.hara.pg — 2011-04-26T06:18:56Z
Created attachment 949 testcase patch pull requested:
https://github.com/D-Programming-Language/dmd/pull/42
Comment #2
by bugzilla — 2011-06-17T22:38:48Z
https://github.com/D-Programming-Language/dmd/commit/541c495d1f208f89ee9031cce796fe9598146cbc