October 03, 2013 Bug again? | ||||
---|---|---|---|---|
| ||||
mixin template test() { int next; } void foo(alias l, alias t)() { t.next = l.next; } void main() { struct A { int next; } A a; mixin test l1; mixin test l2; foo!(l1,a); //ok! foo!(l1,l2); //compilation error! } |
October 03, 2013 Re: Bug again? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Zhouxuan | On Thursday, 3 October 2013 at 12:24:38 UTC, Zhouxuan wrote:
> mixin template test()
> {
> int next;
> }
>
> void foo(alias l, alias t)()
> {
> t.next = l.next;
> }
>
> void main()
> {
> struct A
> {
> int next;
> }
>
> A a;
>
> mixin test l1;
> mixin test l2;
>
> foo!(l1,a); //ok!
> foo!(l1,l2); //compilation error!
> }
Local aliasing problems..?
The error message is
Error: function D main is a nested function and cannot be accessed from t.foo!(l1, l2).foo
Moving the mixins out of main works.
|
Copyright © 1999-2021 by the D Language Foundation