It is incorrect to use d.scope() here because type descriptors are cached,
so the resulting struct type will refer to the scope in which we happen to
see the struct type for the first time.
This also works around an assertion failure in LLVM's code generator that
can occur when a struct type's scope is a lexical block.
I had trouble minimising a test case for this, but it can be reproduced
by building the package "launchpad.net/gozk".
It is incorrect to use d.scope() here because type descriptors are cached, so the resulting struct type will refer to the scope in which we happen to see the struct type for the first time.
This also works around an assertion failure in LLVM's code generator that can occur when a struct type's scope is a lexical block.
I had trouble minimising a test case for this, but it can be reproduced by building the package "launchpad.net/gozk".