Merge from mainline
[official-gcc.git] / gcc / testsuite / g++.dg / ext / packed3.C
blob880b5d9b469249e29ebcb397b6406522c1774dee
1 // { dg-do compile }
3 // Copyright (C) 2003 Free Software Foundation, Inc.
4 // Contributed by Nathan Sidwell 15 Jul 2003 <nathan@codesourcery.com>
6 // Packed fields are unsuitable for direct reference binding.
8 struct Unpacked { int i; };
10 void Ref (int &p);
11 void Ref (Unpacked &p);
13 struct  __attribute__ ((packed)) Packed
15   char c;
16   int i;
17   Unpacked u;
20 void Foo (Packed &p)
22   Ref (p.i); // { dg-error "cannot bind packed field" "" { target { ! default_packed } } }
23   Ref (p.u.i); // { dg-error "cannot bind packed field" "" { target { ! default_packed } } }
24   Ref (p.u); // { dg-error "cannot bind packed field" "" { target { ! default_packed } } }