Is it intentional that forward references in unittests aren't supported nor detected?

Ellery Newcomer ellery-newcomer at utulsa.edu
Thu Jun 3 15:20:52 PDT 2010


On 06/03/2010 05:04 PM, Trass3r wrote:
> void main()
> {
> }
>
> unittest
> {
> struct S
> {
> S2 s;
> }
>
> struct S2
> {
> }
>
> S s;
> }
>
> yields:
> unittests.d(9): Error: identifier 'S2' is not defined
> unittests.d(9): Error: S2 is used as a type
> unittests.d(8): Error: no size for type _error_
> Error: no size for type _error_
>
>
> while putting S2 in front of S works makes it work.
>
> Is this intentional?

It's intentional. Forward references generally aren't allowed inside 
function bodies.


More information about the Digitalmars-d mailing list