mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 21:21:48 +03:00
fix Issue 24262 - Assert error with bit fields (#15864)
This commit is contained in:
parent
e1197fc765
commit
ec34292ead
2 changed files with 70 additions and 18 deletions
|
@ -254,6 +254,34 @@ _Static_assert(test7s2() == -2, "3");
|
|||
|
||||
/******************************************/
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=24257
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
struct Entry
|
||||
{
|
||||
unsigned id : 15;
|
||||
_Bool done : 1;
|
||||
};
|
||||
|
||||
struct State
|
||||
{
|
||||
struct Entry e;
|
||||
};
|
||||
|
||||
void test24257()
|
||||
{
|
||||
int i = 72;
|
||||
struct State s = (struct State){i};
|
||||
if (s.e.id != 72)
|
||||
{
|
||||
printf("error %d\n", __LINE__);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************/
|
||||
|
||||
int main()
|
||||
{
|
||||
test1();
|
||||
|
@ -263,6 +291,7 @@ int main()
|
|||
test5();
|
||||
test6();
|
||||
test7();
|
||||
test24257();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue