summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/pr79761.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/pr79761.C')
-rw-r--r--gcc/testsuite/g++.dg/pr79761.C34
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/pr79761.C b/gcc/testsuite/g++.dg/pr79761.C
new file mode 100644
index 00000000000..a97325a1fc4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr79761.C
@@ -0,0 +1,34 @@
+/* { dg-do compile { target { { i?86-*-* x86_64-*-* } && { ! x32 } } } } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx -mabi=ms" } */
+
+struct Foo
+{
+ Foo() : a(1), b(1), c('a') {}
+ int a;
+ int b;
+ char c;
+};
+
+static Foo copy_foo(Foo) __attribute__((noinline, noclone));
+
+static Foo copy_foo(Foo A)
+{
+ return A;
+}
+
+struct Bar : Foo
+{
+ Bar(Foo t) : Foo(copy_foo(t)) {}
+};
+
+Foo F;
+
+int main (void)
+{
+ Bar B (F);
+
+ if (B.a != 1 || B.b != 1 || B.c != 'a')
+ __builtin_abort ();
+
+ return 0;
+}