summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.jason/byval.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.jason/byval.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.jason/byval.C20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/byval.C b/gcc/testsuite/g++.old-deja/g++.jason/byval.C
new file mode 100644
index 000000000..e09c6ea66
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.jason/byval.C
@@ -0,0 +1,20 @@
+// { dg-do run }
+// Bug: a is destroyed in both foo() and main()
+
+int count;
+
+struct A {
+ double a,b;
+ A(int) { count++; }
+ A(const A&) { count++; }
+ ~A() { count--; }
+};
+
+void foo (A a)
+{ }
+
+int main()
+{
+ foo (1);
+ return count;
+}