Skip to content

anonymous structs members of a typedef struct end up with the same name #217

Closed
@RSDuck

Description

@RSDuck

Consider this example:

typedef struct
{
    struct
    {
        struct
        {
            int a;
        } meow;
    } meow2;
} miauz;

c2nim generates this code for it:

type
  INNER_C_STRUCT_nestedanonymousstruct_11* {.bycopy.} = object
    a*: cint

  INNER_C_STRUCT_nestedanonymousstruct_11* {.bycopy.} = object
    meow*: INNER_C_STRUCT_nestedanonymousstruct_11

  miauz* {.bycopy.} = object
    meow2*: INNER_C_STRUCT_nestedanonymousstruct_11

I figured out that this is because of the backtracking and I could fix it somehow, though everything I can come up with would be a bit invasive and a bit dirty. So any suggestions how to approach this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions