Thread overview
[Issue 14176] the code has a link problem.
Feb 13, 2015
steven kladitis
Feb 13, 2015
steven kladitis
Feb 14, 2015
Kenji Hara
Feb 14, 2015
Kenji Hara
Feb 14, 2015
steven kladitis
Jun 26, 2017
Vladimir Panteleev
February 13, 2015
https://issues.dlang.org/show_bug.cgi?id=14176

--- Comment #1 from steven kladitis <steven_kladitis@yahoo.com> ---
the code came the tuple page on this web site.

--
February 13, 2015
https://issues.dlang.org/show_bug.cgi?id=14176

--- Comment #2 from steven kladitis <steven_kladitis@yahoo.com> ---
this is using dmd 2.066.1 for windows

--
February 14, 2015
https://issues.dlang.org/show_bug.cgi?id=14176

--- Comment #3 from Kenji Hara <k.hara.pg@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; }

--
February 14, 2015
https://issues.dlang.org/show_bug.cgi?id=14176

--- Comment #4 from Kenji Hara <k.hara.pg@gmail.com> ---
(In reply to steven kladitis from comment #1)
> the code came the tuple page on this web site.

Note that, D supports separate compilation model. `int foo(int x, int y);` is a
function declaration without its definition (== function body code), similar
to:

// A C lib function declaration
extern(C) int printf(const char* fmt, ...);

So it's not a mistake in the example code is.

--
February 14, 2015
https://issues.dlang.org/show_bug.cgi?id=14176

--- Comment #5 from steven kladitis <steven_kladitis@yahoo.com> ---
Thanks, I am trying to learn D. :) Trying examples to see what they do.

--
June 26, 2017
https://issues.dlang.org/show_bug.cgi?id=14176

Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dlang-bugzilla@thecybershad
                   |                            |ow.net
         Resolution|---                         |INVALID

--- Comment #6 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> ---
Closing as per Kenji's explanation.

--