summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ext/packed8.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/ext/packed8.C')
-rw-r--r--gcc/testsuite/g++.dg/ext/packed8.C24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/ext/packed8.C b/gcc/testsuite/g++.dg/ext/packed8.C
new file mode 100644
index 000000000..91ee8b3ee
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/packed8.C
@@ -0,0 +1,24 @@
+// PR c++/18378
+// NOTE: This test assumes packed structure layout differs from unpacked
+// structure layout. This isn't true, e.g., with the default
+// arm-none-elf options.
+// { dg-options "-mstructure-size-boundary=8" { target arm*-*-* } }
+
+class A
+{
+public:
+ int i;
+
+ A() {}
+ A(const A& a) { i = a.i; }
+};
+
+class B
+{
+ A a __attribute__((packed)); // { dg-warning "attribute ignored" "" { target default_packed } }
+
+public:
+ B() {}
+ A GetA() { return a; } // { dg-error "" "" { target { ! default_packed } } }
+};
+