aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/dtor1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/opt/dtor1.C')
-rw-r--r--gcc/testsuite/g++.dg/opt/dtor1.C27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/opt/dtor1.C b/gcc/testsuite/g++.dg/opt/dtor1.C
new file mode 100644
index 00000000000..0352676c5f7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/dtor1.C
@@ -0,0 +1,27 @@
+// { dg-do run }
+// { dg-options "-O2" }
+
+int i;
+
+struct S {
+ S ();
+ S (const S&);
+ ~S ();
+};
+
+S::S () { ++i; }
+S::S (const S&) { ++i; }
+S::~S () { --i; }
+
+inline void f (S) {
+}
+
+int main () {
+ {
+ S s;
+ f (s);
+ }
+
+ return i;
+}
+