Bug 5167 – argument to function expecting a C callback parameter isn't checked for linkage type
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-11-05T04:55:00Z
Last change time
2015-06-09T05:12:02Z
Keywords
accepts-invalid, diagnostic
Assigned to
nobody
Creator
hoganmeier
Comments
Comment #0 by hoganmeier — 2010-11-05T04:55:30Z
extern(C)
{
alias /* extern(C)*/ void function() ft;
void func(ft fp)
{
fp();
}
}
void foo()
{
}
void main()
{
func(&foo);
}
This compiles just fine even though foo has improper linkage.
I guess this could yield a corrupt stack when used with a C library.