[Bug c++/66857] [5/6 Regression] Reference not bound to lvalue

2015-08-14 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66857

--- Comment #7 from Jason Merrill jason at gcc dot gnu.org ---
Author: jason
Date: Fri Aug 14 16:33:10 2015
New Revision: 226897

URL: https://gcc.gnu.org/viewcvs?rev=226897root=gccview=rev
Log:
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.

Added:
branches/gcc-5-branch/gcc/testsuite/g++.dg/init/pr66857.C
Modified:
branches/gcc-5-branch/gcc/cp/ChangeLog
branches/gcc-5-branch/gcc/cp/cvt.c


[Bug c++/66857] [5/6 Regression] Reference not bound to lvalue

2015-08-14 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66857

Jason Merrill jason at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |5.3

--- Comment #8 from Jason Merrill jason at gcc dot gnu.org ---
Fixed.


[Bug c++/66857] [5/6 Regression] Reference not bound to lvalue

2015-07-25 Thread ppalka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66857

--- Comment #6 from Patrick Palka ppalka at gcc dot gnu.org ---
Author: ppalka
Date: Sat Jul 25 23:15:44 2015
New Revision: 226228

URL: https://gcc.gnu.org/viewcvs?rev=226228root=gccview=rev
Log:
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.


Added:
trunk/gcc/testsuite/g++.dg/init/pr66857.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/cvt.c
trunk/gcc/testsuite/ChangeLog


[Bug c++/66857] [5/6 Regression] Reference not bound to lvalue

2015-07-15 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66857

--- Comment #5 from Jason Merrill jason at gcc dot gnu.org ---
(In reply to Patrick Palka from comment #4)
 Reverting the change made to ocp_convert in r217814 fixes it:
 
 diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
 index 13bc1f7..6d4bd9a 100644
 --- a/gcc/cp/cvt.c
 +++ b/gcc/cp/cvt.c
 @@ -687,7 +687,8 @@ ocp_convert (tree type, tree expr, int convtype, int
 flags,
  }
 
/* 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))
  return error_mark_node;

This fix is OK.


[Bug c++/66857] [5/6 Regression] Reference not bound to lvalue

2015-07-13 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66857

Markus Trippelsdorf trippels at gcc dot gnu.org changed:

   What|Removed |Added

 CC||jason at gcc dot gnu.org,
   ||trippels at gcc dot gnu.org

--- Comment #3 from Markus Trippelsdorf trippels at gcc dot gnu.org ---
Started with r217814.


[Bug c++/66857] [5/6 Regression] Reference not bound to lvalue

2015-07-13 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66857

--- Comment #2 from Jonathan Wakely redi at gcc dot gnu.org ---
The gimple dump shows a temporary int being created from the global, and the
temporary is passed to the constructor.


[Bug c++/66857] [5/6 Regression] Reference not bound to lvalue

2015-07-13 Thread ppalka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66857

Patrick Palka ppalka at gcc dot gnu.org changed:

   What|Removed |Added

 CC||ppalka at gcc dot gnu.org

--- Comment #4 from Patrick Palka ppalka at gcc dot gnu.org ---
Reverting the change made to ocp_convert in r217814 fixes it:

diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 13bc1f7..6d4bd9a 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -687,7 +687,8 @@ ocp_convert (tree type, tree expr, int convtype, int flags,
 }

   /* 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))
 return error_mark_node;