summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/init/cleanup2.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/init/cleanup2.C')
-rw-r--r--gcc/testsuite/g++.dg/init/cleanup2.C19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/init/cleanup2.C b/gcc/testsuite/g++.dg/init/cleanup2.C
new file mode 100644
index 000000000..e62364be1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/cleanup2.C
@@ -0,0 +1,19 @@
+// PR c++/12526
+
+// We decided that the call to strcmp has no side-effects because strcmp is
+// pure, even though the first argument has side-effects. As a result, we
+// stripped the CLEANUP_POINT_EXPR. Hilarity ensued.
+
+extern "C" int strcmp (const char *, const char *);
+
+struct A {
+ A(int);
+ const char *str();
+ ~A();
+};
+
+void printQueryI()
+{
+ if(!strcmp(A(1).str(), "foo"))
+ { }
+}