* call.c (reference_binding): Check LOOKUP_NO_TEMP_BIND when binding
a temp directly to a reference as per DR391.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@133299
138bc75d-0d04-0410-961f-
82ee72b054a4
+2008-03-17 Jason Merrill <jason@redhat.com>
+
+ PR c++/35548
+ * call.c (reference_binding): Check LOOKUP_NO_TEMP_BIND when binding
+ a temp directly to a reference as per DR391.
+
2008-03-12 Richard Guenther <rguenther@suse.de>
PR c++/35469
const and rvalue references to rvalues of compatible class type. */
if (compatible_p
&& (lvalue_p
- || ((CP_TYPE_CONST_NON_VOLATILE_P(to) || TYPE_REF_IS_RVALUE (rto))
+ || (!(flags & LOOKUP_NO_TEMP_BIND)
+ && (CP_TYPE_CONST_NON_VOLATILE_P(to) || TYPE_REF_IS_RVALUE (rto))
&& CLASS_TYPE_P (from))))
{
/* [dcl.init.ref]
+2008-03-17 Jason Merrill <jason@redhat.com>
+
+ PR c++/35548
+ * g++.dg/init/ref16.C: New testcase.
+
2008-03-17 Richard Guenther <rguenther@suse.de>
PR tree-optimization/19637
--- /dev/null
+// PR c++/35548
+// { dg-do run }
+
+int c;
+struct A
+{
+ A() { ++c; }
+ A(const A&) { ++c; }
+ ~A() { --c; }
+};
+
+A f()
+{
+ return A();
+}
+
+int i;
+const A* ap;
+int main()
+{
+ const A& ar = i ? *ap : f();
+ return (c == 0);
+}