Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.brendan/ctors2.C

raw
1 // { dg-do run }
2 // GROUPS passed constructors
3 // Check that sub-words sized class members are correctly set
4 // by constructors.
5
6 extern "C" int printf (const char *, ...);
7
8 struct base {
9 int f1 : 8;
10 int f2 : 8;
11 base (int arg1, int arg2);
12 };
13
14
15 base global_base(0x55, 0x7e);
16
17 int main ()
18 {
19 if ((global_base.f1 != 0x55) || (global_base.f2 != 0x7e))
20 { printf ("FAIL\n"); return 1; }
21 else
22 printf ("PASS\n");
23 }
24
25 base::base(int arg1, int arg2)
26 {
27 f1 = arg1;
28 f2 = arg2;
29 }