Is it intentional that forward references in unittests aren't

retard re at tard.com.invalid
Thu Jun 3 17:44:00 PDT 2010


Thu, 03 Jun 2010 18:30:04 -0400, bearophile wrote:

> Trass3r:
> 
>> void main()
>> {
>> }
>> 
>> unittest
>> {
>> 	struct S
>> 	{
>> 		S2 s;
>> 	}
> 
> Being unittests functions, it can be better to use "static struct" there
> instead of "struct".
> 
> -------------------------
> 
> Ellery Newcomer:
>> It's intentional. Forward references generally aren't allowed inside
>> function bodies.
> 
> Unittests being normal functions is an abstraction that leaks a bit, but
> I presume it's OK.

What does this mean? Can't you write a wrapper struct/class inside the 
block if you don't want to expose S and S2 outside the unittest block.


More information about the Digitalmars-d mailing list