Simple implementation of __FUNCTION
Rob T
rob at ucora.com
Mon Nov 5 22:09:59 PST 2012
On Friday, 2 November 2012 at 22:33:37 UTC, Rob T wrote:
> 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
An update on this problem. I found out that the error when using
auto as return type has nothing to do with the mixin. The
compiler error persists when you take mixin out and put in the
__traits( ... ) code directly.
Does anyone else think that this is a compiler bug? If it is a
bug then I'll report it in the bug tracker.
--rt
More information about the Digitalmars-d
mailing list