Bug 3733 – Overloading on 'this' modifiers fails with implicit 'this'
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-01-22T02:44:00Z
Last change time
2015-06-09T01:27:22Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
d_lang
Comments
Comment #0 by d_lang — 2010-01-22T02:44:08Z
Sample code:
--------
class SampleClass
{
void foo() {}
shared
void foo() {}
void bar()
{
foo();
}
}
--------
Result with dmd 2.039:
--------
test.d(10): Error: function test.SampleClass.foo called with argument types:
(())
matches both:
test.SampleClass.foo()
and:
test.SampleClass.foo()
--------
I think that no shared 'foo' method should be called in 'bar' method.
If 'foo' method is called from 'this' pointer explicitly, dmd compile successfully.
--------
void bar()
{
this.foo();
}
--------
Comment #1 by yebblies — 2011-07-02T22:09:36Z
*** Issue 4392 has been marked as a duplicate of this issue. ***
Comment #2 by yebblies — 2011-07-02T22:11:37Z
This applies to any this modifier, not just shared.