Inner function overload bug?
Philippe Sigaud
philippe.sigaud at gmail.com
Wed Jan 9 02:53:44 PST 2013
On Wed, Jan 9, 2013 at 1:53 AM, Andrej Mitrovic
<andrej.mitrovich at gmail.com> wrote:
> On 1/9/13, bearophile <bearophileHUGS at lycos.com> wrote:
>> If you define an inner static struct, its static methods can call
>> each other freely.
>
> You can also use a mixin template:
>
> 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);
> }
That's weird. Why does that work? Directly pasting the mixin content
in main() does not compile, right?
More information about the Digitalmars-d-learn
mailing list