mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
fix Issue 24026 - ImportC: ICE on nested C initializer 2 (#15375)
This commit is contained in:
parent
11d8f17c0f
commit
78dc82bca2
2 changed files with 51 additions and 9 deletions
66
compiler/test/runnable/test23786.c
Normal file
66
compiler/test/runnable/test23786.c
Normal file
|
@ -0,0 +1,66 @@
|
|||
// https://issues.dlang.org/show_bug.cgi?id=23768
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
struct {
|
||||
int o;
|
||||
} f;
|
||||
};
|
||||
} T;
|
||||
|
||||
void f(void) {
|
||||
T data = (T) {
|
||||
{.f = {.o = 0}}
|
||||
};
|
||||
}
|
||||
|
||||
/***************/
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
struct {
|
||||
struct { double o; } f;
|
||||
};
|
||||
};
|
||||
} S;
|
||||
|
||||
_Static_assert(sizeof(S) == 8, "1");
|
||||
|
||||
void test23768()
|
||||
{
|
||||
S data = (S) {
|
||||
{{.f = {.o = 3}}}
|
||||
};
|
||||
__check(data.f.o == 3);
|
||||
S s;
|
||||
s.f.o = 4;
|
||||
__check(s.f.o == 4);
|
||||
}
|
||||
|
||||
/**************************/
|
||||
// https://issues.dlang.org/show_bug.cgi?id=24026
|
||||
|
||||
struct A
|
||||
{
|
||||
int type;
|
||||
};
|
||||
|
||||
struct E
|
||||
{
|
||||
struct A action;
|
||||
};
|
||||
|
||||
void test24026()
|
||||
{
|
||||
struct E entry = {{ .type = 1 }};
|
||||
__check(entry.action.type == 1);
|
||||
}
|
||||
|
||||
/**************************/
|
||||
|
||||
int main()
|
||||
{
|
||||
test23768();
|
||||
test24026();
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue