template instance cannot use local 'f' as parameter to non-global template

Stephan spam at extrawurst.org
Wed Jul 13 06:55:06 PDT 2011


On 12.07.2011 15:06, Trass3r wrote:
> Is this a bug? If not, how do you make it work?
>
> void h() {}
>
> class Bla
> {
> mixin wrap!h;
> }
>
> mixin template wrap(alias f)
> {
> void blub(alias g = f)()
> {
> }
> }
>
> void main()
> {
> Bla b = new Bla();
> b.blub();
> }
>
> test.d(18): Error: template instance cannot use local 'f' as parameter
> to non-global template blub(alias g = f)
> test.d(18): Error: template instance forward reference of f
> test.d(18): Error: template instance test.Bla.wrap!(h).blub!(f) error
> instantiating

I am not sure but i am not that used to those template aliases anyway.


More information about the Digitalmars-d-learn mailing list