D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3733 - Overloading on 'this' modifiers fails with implicit 'this'
Summary: Overloading on 'this' modifiers fails with implicit 'this'
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: patch, rejects-valid
: 4392 7276 (view as issue list)
Depends on:
Blocks:
 
Reported: 2010-01-22 02:44 UTC by Takuya Kurosawa
Modified: 2015-06-09 01:27 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Takuya Kurosawa 2010-01-22 02:44:08 UTC
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 yebblies 2011-07-02 22:09:36 UTC
*** Issue 4392 has been marked as a duplicate of this issue. ***
Comment 2 yebblies 2011-07-02 22:11:37 UTC
This applies to any this modifier, not just shared.
Comment 4 Kenji Hara 2012-01-11 23:07:19 UTC
*** Issue 7276 has been marked as a duplicate of this issue. ***