Forward reference not working in nested functions

Jacob Carlborg doob at me.com
Wed Dec 12 12:02:47 PST 2012


On 2012-12-12 19:03, H. S. Teoh wrote:
> Is this a known bug or deliberate limitation?
>
> 	void func(T)(T data) {
> 		void subfunc1() {
> 			process(data);
> 			if (recurse) subfunc2(); // Error: subfunc2 undefined
> 		}
>
> 		void subfunc2() {
> 			process(data);
> 			if (recurse) subfunc1(); // Error: subfunc1 undefined
> 		}
>
> 		subfunc1();
> 	}

It's basically the same thing as you need to declare variables in 
correct order in a function.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list