summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/expr/cond6.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/expr/cond6.C')
-rw-r--r--gcc/testsuite/g++.dg/expr/cond6.C24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/expr/cond6.C b/gcc/testsuite/g++.dg/expr/cond6.C
new file mode 100644
index 000000000..943aa85a9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/expr/cond6.C
@@ -0,0 +1,24 @@
+// { dg-do run }
+
+extern "C" void abort ();
+
+struct B {
+ B() {}
+ B(const B& b) { abort (); }
+};
+
+struct D : public B {
+ D() {}
+ D(const D& d) : B() {}
+};
+
+D d;
+B b;
+
+D f() {
+ return d;
+}
+
+int main () {
+ b = (true ? f() : b);
+}