diff options
author | Patrick Palka <ppalka@gcc.gnu.org> | 2015-07-25 23:15:44 +0000 |
---|---|---|
committer | Patrick Palka <ppalka@gcc.gnu.org> | 2015-07-25 23:15:44 +0000 |
commit | 9783ae5a2f44f714809321c4bb2d5534d50c19a4 (patch) | |
tree | 89d36d2f44fb506176db6a4679bb4c26d0cb8b63 | |
parent | 39a8bd7b642eb85f66ac9c7755a371c4532e267e (diff) | |
download | gcc-9783ae5a2f44f714809321c4bb2d5534d50c19a4.zip gcc-9783ae5a2f44f714809321c4bb2d5534d50c19a4.tar.gz gcc-9783ae5a2f44f714809321c4bb2d5534d50c19a4.tar.bz2 |
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
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/cvt.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/init/pr66857.C | 19 |
4 files changed, 32 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7cb343f..f7669d3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +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> PR c++/64969 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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d842193..67148bb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +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> PR target/66648 diff --git a/gcc/testsuite/g++.dg/init/pr66857.C b/gcc/testsuite/g++.dg/init/pr66857.C new file mode 100644 index 0000000..43b0927 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/pr66857.C @@ -0,0 +1,19 @@ +// 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; +} |