Implicit conversion bug?

Thomas Kuehne thomas-dloop at kuehne.cn
Thu Feb 23 23:32:07 PST 2006


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

Kramer schrieb am 2006-02-10:

[snip]

> Not sure if this is supposed to be allowed for nested functions (couldn't find
> anything in the docs), but when both of the nested functions are there, it won't
> compile.  Comment one or the other and it compiles clean.
>
> # import std.string, std.utf;
>
> # void main(char[][] args) {
> #     char[] func(char[] str) {
> #         char[] toString(wchar c) {
> #             wchar[] result;
> #             result.length = 1;
> #             result[0] = c;
> #             return std.utf.toUTF8(result);
> #         }
>
> #         char[] toString(dchar c) {
> #             dchar[] result;
> #             result.length = 1;
> #             result[0] = c;
> #             return std.utf.toUTF8(result);
> #         }
>
> #         return str;
> #     }
> # }
>
> produces this:
> bug.d(12): declaration toString is already defined

http://digitalmars.com/d/function.html:
| Unlike module level declarations, declarations within function scope
| are processed in order. 

Thomas


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

iD8DBQFD/rwv3w+/yD4P9tIRAszCAJwOFpdqxKPksoI6+DGDSfoDnn8uUwCglw1u
avPQyRLGKx+/zG8wmEv38Io=
=i3GT
-----END PGP SIGNATURE-----



More information about the Digitalmars-d-bugs mailing list