[Issue 14176] the code has a link problem.

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Feb 14 07:36:46 PST 2015


https://issues.dlang.org/show_bug.cgi?id=14176

--- Comment #3 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to steven kladitis from comment #0)
> import std.stdio;
> import std.traits;
> 
> int foo(int x, long y);
> 
> void Bar(R, P...)(R function(P))
> {
>     writeln("return type is ", typeid(R));
>     writeln("parameter types are ", typeid(P));
> }
> 
> void main()
> {
> Bar(&foo);
> }
> 
> 
> // compiles but does not link in windows

A function pointer &foo should point actual function body code. But foo does
not have body. Therefore it fails to link.

Supplying body code to foo will fix the issue.

int foo(int x, long y) { return 0; }

--


More information about the Digitalmars-d-bugs mailing list