On 26 February 2013 17:33, Vladimir Kalinin <vkalinin@opendesign.com> wrote:
There is a test "nested_structs" where following declaration is
wrapped:

%inline %{
struct Outer {
  struct {
    int val;
  } inner1, inner2, *inner3, inner4[1];
  struct Named {
    int val;
  } inside1, inside2, *inside3, inside4[1];
} outer;
%}

For this example SWIG ignores named nested structure name ("Named")
and instead treats it as unnamed.
Is that intentional?

Also, for unnamed structure, four different typedefs are generated, so
that in the target language outer.inner1 and outer.inner2 are totally
unrelated. Would it not be more logical to create one typedef and use
it for all the declarations?

I met that case in Java test suite testing nested classes handling,
and I don't know whether to change the test or fix the implementation
to emulate the old behaviour.

The nested wrappers are a bit hit and miss. Any inconsistencies should be tidied up, so in this case I would ensure the 'Named' struct is wrapped as a named nested struct. 

Regarding unnamed nested structs, it would be better to have a common name, but how would you choose one? I don't think there is one ideal solution, so perhaps just keep it the same as it is now. Any better ideas?

William