Commit 9783ae5a by Patrick Palka

re PR c++/66857 (Reference not bound to lvalue)

Fix PR c++/66857

gcc/cp/ChangeLog:

	PR c++/66857
	* cvt.c (ocp_convert): Don't call scalar_constant_value when
	converting to a class type.

gcc/testsuite/ChangeLog:

	PR c++/66857
	* g++.dg/init/pr66857.C: New test.

From-SVN: r226228
parent 39a8bd7b
2015-07-25 Patrick Palka <ppalka@gcc.gnu.org>
PR c++/66857
* cvt.c (ocp_convert): Don't call scalar_constant_value when
converting to a class type.
2015-07-24 Jason Merrill <jason@redhat.com> 2015-07-24 Jason Merrill <jason@redhat.com>
PR c++/64969 PR c++/64969
......
...@@ -687,7 +687,8 @@ ocp_convert (tree type, tree expr, int convtype, int flags, ...@@ -687,7 +687,8 @@ ocp_convert (tree type, tree expr, int convtype, int flags,
} }
/* FIXME remove when moving to c_fully_fold model. */ /* FIXME remove when moving to c_fully_fold model. */
e = scalar_constant_value (e); if (!CLASS_TYPE_P (type))
e = scalar_constant_value (e);
if (error_operand_p (e)) if (error_operand_p (e))
return error_mark_node; return error_mark_node;
......
2015-07-25 Patrick Palka <ppalka@gcc.gnu.org>
PR c++/66857
* g++.dg/init/pr66857.C: New test.
2015-07-25 Uros Bizjak <ubizjak@gmail.com> 2015-07-25 Uros Bizjak <ubizjak@gmail.com>
PR target/66648 PR target/66648
......
// PR c++/66857
// { dg-do run }
const int i = 0;
struct Test
{
Test (const int &rhs)
{
if (&rhs != &i)
__builtin_abort ();
}
};
int
main (void)
{
Test test = i;
}
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