re PR c++/10245 (?: operator requires public copy constructor of return type)
authorJason Merrill <jason@gcc.gnu.org>
Sat, 29 Mar 2003 00:50:46 +0000 (19:50 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Sat, 29 Mar 2003 00:50:46 +0000 (19:50 -0500)
        PR c++/10245
        * cvt.c (force_rvalue): New fn.
        * call.c (build_conditional_expr): Use it.
        * cp-tree.h: Declare it.

[[Split portion of a mixed commit.]]

From-SVN: r65006.2

gcc/testsuite/g++.dg/conversion/cond2.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/conversion/cond2.C b/gcc/testsuite/g++.dg/conversion/cond2.C
new file mode 100644 (file)
index 0000000..d31de33
--- /dev/null
@@ -0,0 +1,15 @@
+// PR c++/10245
+
+struct X {};
+    
+struct Y {
+  Y ();
+  operator X () const;
+private:
+  Y (const Y &);
+};
+
+Y y;
+void foo() {
+  X x = (1 ? Y() : Y());
+}