aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.jason/return2.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.jason/return2.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.jason/return2.C23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/return2.C b/gcc/testsuite/g++.old-deja/g++.jason/return2.C
new file mode 100644
index 00000000000..272390903e8
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.jason/return2.C
@@ -0,0 +1,23 @@
+// PRMS Id: 5368
+// Bug: the X temporary in foo() is not destroyed.
+
+int c = 0;
+
+struct X {
+ X (int) { c++; }
+ ~X() { c--; }
+};
+
+struct Y {
+ Y(const X &) { }
+};
+
+Y foo() {
+ return X(3);
+};
+
+int main()
+{
+ foo();
+ return c;
+}