Skip to content

Lowering to LLVM fails for constant array of unions with unequal initializer types #1185

@bruteforceboy

Description

@bruteforceboy

In, #1166, is there a reason why setting CommonElementType = nullptr was removed when all the elements don't have the same type?

For example, the following code snippet now fails when lowering to LLVM:

typedef struct {
  char a;
} S_1;

typedef struct {
  long a, b;
} S_2;

typedef union {
  S_1 a;
  S_2 b;
} U;

void foo() { U arr[2] = {{.b = {1, 2}}, {.a = {1}}}; }

cc: @bcardosolopes, @ChuanqiXu9

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