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

Steven Schveighoffer schveiguy at yahoo.com
Wed Jul 13 07:02:11 PDT 2011


On Tue, 12 Jul 2011 09:06:56 -0400, Trass3r <un at known.com> 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've seen this error before...

*searches memory and old code*

Here you go: http://d.puremagic.com/issues/show_bug.cgi?id=3051

As a workaround, is there a reason you need blub to be parameterized?  I  
mean, f is already part of the template.

-Steve


More information about the Digitalmars-d-learn mailing list