2017-10-21 23:40:19 +00:00
|
|
|
/* Conformance Test 4.6.7.1: Verification of union initialization */
|
|
|
|
|
2022-10-17 22:50:42 +00:00
|
|
|
int printf(const char *, ...);
|
|
|
|
|
2017-10-21 23:40:19 +00:00
|
|
|
union U1 { int i;
|
|
|
|
long L;
|
|
|
|
float f; };
|
|
|
|
|
|
|
|
union U1 u1 = { 3 };
|
2016-10-15 01:21:43 +00:00
|
|
|
static union U1 u2 = { 5 };
|
2017-10-21 23:40:19 +00:00
|
|
|
|
2022-10-17 22:50:42 +00:00
|
|
|
int main (void)
|
2017-10-21 23:40:19 +00:00
|
|
|
{
|
|
|
|
auto union U1 u3 = { 32767 };
|
|
|
|
|
|
|
|
if (u1.i != 3)
|
|
|
|
goto Fail;
|
|
|
|
|
|
|
|
if (u2.i != 5)
|
|
|
|
goto Fail;
|
|
|
|
|
|
|
|
if (u3.i != 32767)
|
|
|
|
goto Fail;
|
|
|
|
|
|
|
|
printf ("Passed Conformance Test 4.6.7.1\n");
|
2022-10-17 22:50:42 +00:00
|
|
|
return 0;
|
2017-10-21 23:40:19 +00:00
|
|
|
|
|
|
|
Fail:
|
|
|
|
printf ("Failed Conformance Test 4.6.7.1\n");
|
|
|
|
}
|