link errors with 0.149, templates, and writefln

Thomas Kuehne thomas-dloop at kuehne.cn
Tue Mar 14 12:41:31 PST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Kevin Bealer schrieb am 2006-03-13:
>
> When I try to compile the following two files, I get a working program, but if
> the unused function "quux" is removed, the compile fails with a symbol error at
> link time.  It looks like the writefln() in quux brings in the necessary symbols
> but the similar writefln() in the template does not do so.
>
> This does not seem to be related to IFTI -- if I change that the error still
> seems to happen.
>
> NOTE: this is on a 64 bit machine in Linux, so I need to manually link with gcc
> using a slight variant of the "gcc" command that dmd uses.  I can provide more
> data on this if needed.
>
> The compiler is DMD 0.149 for Linux.
>
> The errors look like this:
>
> /home/marlon/src/dscript/trydmd1.d:8: undefined reference to `_arguments_Aad'
> /home/marlon/src/dscript/trydmd1.d:8: undefined reference to `_arguments_Aad'
>
>>> autotmp.d
>:
>: import std.stdio;
>:
>: template foo(f1)
>: {
>:     void foo(f1 x)
>:     {
>:         writefln("no dice, chicago, %s.", x);
>:     }
>: }
>:
>:
>>> trydmd1.d
>:
>: import std.stdio;
>: import autotmp;
>:
>: // removal of the quux function breaks the compile
>: //void quux(int x)
>: //{
>: //   double foo = x + 4;
>: //    writefln("no dice %s.", foo);
>: //}
>:
>: int main(char[][] args)
>: {
>:     foo(-29.0);
>:
>:     if (args.length > 1) {
>:         writefln("%s", args[1]);
>:     }
>:     return 0;
>: }
>:

FAIL:
dmd -c autotmp.d
dmd -c trydmd1.d
dmd autotmp.o trydmd1.o

PASS:
dmd autotmp.d trydmd1.d

Added to DStress as
http://dstress.kuehne.cn/complex/arguments

(It's a "complex" target due to its multistage build process.)

Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFEFzbn3w+/yD4P9tIRAnQ2AJ4zzHnyhJVk4YrsPltMELI0JWDy1QCfaQKC
4QtePXTq+7sodj+t6+YMq7I=
=cSmb
-----END PGP SIGNATURE-----



More information about the Digitalmars-d-bugs mailing list