gcc/testsuite/g++.dg/ext/packed8.C
raw| 1 | // PR c++/18378 |
| 2 | // NOTE: This test assumes packed structure layout differs from unpacked |
| 3 | // structure layout. |
| 4 | |
| 5 | class A |
| 6 | { |
| 7 | public: |
| 8 | int i; |
| 9 | |
| 10 | A() {} |
| 11 | A(const A& a) { i = a.i; } |
| 12 | }; |
| 13 | |
| 14 | class B |
| 15 | { |
| 16 | A a __attribute__((packed)); // { dg-warning "attribute ignored" "" { target default_packed } } |
| 17 | |
| 18 | public: |
| 19 | B() {} |
| 20 | A GetA() { return a; } // { dg-error "" "" { target { ! default_packed } } } |
| 21 | }; |
| 22 |