[Issue 3252] New: undefined reference to package function called from an interface
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Aug 16 03:31:37 PDT 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3252
Summary: undefined reference to package function called from an
interface
Product: D
Version: 1.045
Platform: x86
OS/Version: Linux
Status: NEW
Keywords: link-failure
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: diggory.hardy at gmail.com
When attempting to call a function with package protection level from an
interface, I get an undefined reference error.
Code:
/** Compiler error - calling a package interface function.
*/
module packageFunc;
interface I {
package void iPack();
}
class A : I {
package void iPack() {}
}
void main () {
A a = new A;
I i = a;
i.iPack; // causes an undefined reference
(cast(A) i).iPack; // a workaround
}
The linker error:
# dmd packageFunc.d
packageFunc.o: In function `_Dmain':
packageFunc.d:(.text._Dmain+0x22): undefined reference to
`_D11packageFunc1I5iPackMFZv'
collect2: ld returned 1 exit status
--- errorlevel 1
Possibly similar to bug 2894.
This just bit me when including package protection to a lot of class functions
in order to implement invariant tests (where package protection is the only
applicable type of protection). I presume it's a bug; haven't tested if it's
also the case with dmd 2.0 or other compilers yet. Any idea if it would be
simple to fix?
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list