Inner function overload bug?

Era Scarecrow rtcvb32 at yahoo.com
Tue Jan 8 17:54:32 PST 2013


On Wednesday, 9 January 2013 at 00:53:16 UTC, Andrej Mitrovic 
wrote:
> mixin template S()
> {
>     void test(ref int x) { x = test(); }
>     int test() { return 1; }
> }
>
> void main()
> {
>     mixin S;
>
>     int x;
>     test(x);
>     assert(x == 1);
> }

  An interesting idea, but the more obvious uses it would be for 
is bitfields or something similar, which is generated text and 
mixed in. Would you do a mixin within a mixin template to get 
that to work? I'd rather just mixin directly to the function.

//works with above main?
mixin template S()
{
     mixin(bitfields!(
             int, "test", 8,
     ));
}


More information about the Digitalmars-d-learn mailing list