Thread overview
[Issue 6266] New: Mac OSX linker fails to recognize private method of interface
Jul 07, 2011
Blazej Podsiadlo
Jul 07, 2011
Blazej Podsiadlo
Jul 08, 2011
yebblies
Jul 08, 2011
yebblies
Jul 10, 2011
Blazej Podsiadlo
Jul 10, 2011
kennytm@gmail.com
July 07, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6266

           Summary: Mac OSX linker fails to recognize private method of
                    interface
           Product: D
           Version: unspecified
          Platform: x86_64
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: blazej.podsiadlo@gmail.com


--- Comment #0 from Blazej Podsiadlo <blazej.podsiadlo@gmail.com> 2011-07-07 13:20:14 PDT ---
Hi,
Linker fails to process following code when interface methods are private:
The same code with protected/public methods works fine...
-----------------------------
import std.stdio;

interface Foo {
  private void foo();

    public final void doFooFoo() {
        foo();
        foo();
    };

};

class MyFoo : Foo {
  override private void foo() {
        writeln("foo()");
    }
};

void main(string[] args) {
    MyFoo mf = new MyFoo;
    mf.doFooFoo();
    writeln("Done.");
}
---------------------------
Undefined symbols for architecture i386:
  "_D4stat3Foo3fooMFZv", referenced from:
      _D4stat3Foo8doFooFooMFZv in stat.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
--- errorlevel 1

Best Regards,
Blazej

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 07, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6266



--- Comment #1 from Blazej Podsiadlo <blazej.podsiadlo@gmail.com> 2011-07-07 13:21:50 PDT ---
Created an attachment (id=1005)
The object file compiled by dmd -c

orginal name was stat.o

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 08, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6266


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies@gmail.com


--- Comment #2 from yebblies <yebblies@gmail.com> 2011-07-08 16:08:56 EST ---
private methods are implicitly final.  It is correct that it fails to link, but it should be an error as MyFoo.foo does not override any function.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 08, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6266


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


--- Comment #3 from yebblies <yebblies@gmail.com> 2011-07-08 17:00:15 EST ---
*** This issue has been marked as a duplicate of issue 3581 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 10, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6266


Blazej Podsiadlo <blazej.podsiadlo@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|DUPLICATE                   |


--- Comment #4 from Blazej Podsiadlo <blazej.podsiadlo@gmail.com> 2011-07-10 11:49:48 PDT ---
Hi,
I'm not sure if all private methods should be implicitly final.
I've been trying to implement NVI (Non-Virtual Interface) Idiom found in
Alexandrescu's book (p213).
Could you please make sure about that?
Thank you,
Blazej

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 10, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6266


kennytm@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |DUPLICATE


--- Comment #5 from kennytm@gmail.com 2011-07-10 11:54:22 PDT ---
(In reply to comment #4)
> Hi,
> I'm not sure if all private methods should be implicitly final.
> I've been trying to implement NVI (Non-Virtual Interface) Idiom found in
> Alexandrescu's book (p213).
> Could you please make sure about that?
> Thank you,
> Blazej

Please put the comment to bug 4542.

*** This issue has been marked as a duplicate of issue 3581 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------