Simple implementation of __FUNCTION

Rob T rob at ucora.com
Fri Nov 2 15:41:20 PDT 2012


On Friday, 2 November 2012 at 22:33:37 UTC, Rob T wrote:
>
> Unrelated to either form, I discovered it fails to compile when 
> inside a function with "auto" as the return type.
>
> auto test()
> {
>    throw new Exception(  mixin(__FUNCTION) );
>    return 0;
> }
>
> Error: forward reference to test
>
> but this works
>
> int test()
> {
>    throw new Exception(  mixin(__FUNCTION) );
>    return 0;
> }
>
> So we're kinda sunk for inclusion in phobos unless this error 
> can be resolved.
>
> I'll try the enum idea to see if that works.
>
> --rt

No luck with enum version, it still fails to compile when used 
inside a function with auto as the return type, same "forward 
reference" error.

--rt



More information about the Digitalmars-d mailing list