Commit 3d574e5b by Jason Merrill Committed by Jason Merrill

re PR c++/35548 (g++ 4.3 miscompile this simple program)

        PR c++/35548
        * call.c (reference_binding): Check LOOKUP_NO_TEMP_BIND when binding
        a temp directly to a reference as per DR391.

From-SVN: r133299
parent a5728e40
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> 2008-03-12 Richard Guenther <rguenther@suse.de>
PR c++/35469 PR c++/35469
......
...@@ -1145,7 +1145,8 @@ reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags) ...@@ -1145,7 +1145,8 @@ reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags)
const and rvalue references to rvalues of compatible class type. */ const and rvalue references to rvalues of compatible class type. */
if (compatible_p if (compatible_p
&& (lvalue_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)))) && CLASS_TYPE_P (from))))
{ {
/* [dcl.init.ref] /* [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> 2008-03-17 Richard Guenther <rguenther@suse.de>
PR tree-optimization/19637 PR tree-optimization/19637
// 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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment