[Issue 9767] New: Confusing compiler error generated when names collide across modules.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Mar 20 11:10:23 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9767
Summary: Confusing compiler error generated when names collide
across modules.
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: trivial
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: andrew.smith at uk.mlp.com
--- Comment #0 from Andrew Smith <andrew.smith at uk.mlp.com> 2013-03-20 11:10:22 PDT ---
If I create two modules which contain duplicate declarations....
a.d
=====================
module a;
import b;
import std.stdio;
void function() voidFun;
struct foo {
typeof( voidFun ) onCb;
};
void myCb() {
writefln("I've been called");
};
void main() {
foo f = { &myCb };
usefoo(f);
};
and b.d
=========================
module b;
void function() voidFun;
struct foo {
typeof(voidFun) onCb;
};
void usefoo( foo f) {
f.onCb();
};
==============================================
dmd produces following error message.
dmd -I. -c -ofa.o a.d
a.d(18): Error: function b.usefoo (foo f) is not callable using argument types
(foo)
a.d(18): Error: cannot implicitly convert expression (f) of type foo to foo
scons: *** [a.o] Error 1
scons: building terminated because of errors.
================================================
Obviously pilot error on my part but I'd argue the error message could be made
more helpful.
Cheers,
A.
--
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