aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMarek Polacek <mpolacek@gcc.gnu.org>2016-03-10 15:13:01 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2016-03-10 15:13:01 +0000
commitd49b0aa091b9fc87a044941ac93155006ed3fd1e (patch)
treedfec5b3ca0b4f7db3854f2375b8f42a7f31b3ce7 /gcc/cp
parentc81e3837a900d99e7e57d8d180804c2b3337c1dc (diff)
downloadgcc-d49b0aa091b9fc87a044941ac93155006ed3fd1e.zip
gcc-d49b0aa091b9fc87a044941ac93155006ed3fd1e.tar.gz
gcc-d49b0aa091b9fc87a044941ac93155006ed3fd1e.tar.bz2
re PR c++/70153 (ICE on valid C++ code)
PR c++/70153 * cp-gimplify.c (cp_fold): Handle UNARY_PLUS_EXPR. * g++.dg/delayedfold/unary-plus1.C: New test. From-SVN: r234111
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/cp-gimplify.c9
2 files changed, 13 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b4b9b24..6e69e77 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2016-03-10 Marek Polacek <polacek@redhat.com>
+
+ PR c++/70153
+ * cp-gimplify.c (cp_fold): Handle UNARY_PLUS_EXPR.
+
2016-03-09 Cesar Philippidis <cesar@codesourcery.com>
* parser.c (cp_parser_oacc_loop): Update cclauses and clauses
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index 6af3760..6a767fa 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -1996,7 +1996,6 @@ cp_fold (tree x)
case BIT_NOT_EXPR:
case TRUTH_NOT_EXPR:
case FIXED_CONVERT_EXPR:
- case UNARY_PLUS_EXPR:
case INDIRECT_REF:
loc = EXPR_LOCATION (x);
@@ -2016,6 +2015,14 @@ cp_fold (tree x)
|| !VOID_TYPE_P (TREE_TYPE (TREE_OPERAND (x, 0))));
break;
+ case UNARY_PLUS_EXPR:
+ op0 = cp_fold_rvalue (TREE_OPERAND (x, 0));
+ if (op0 == error_mark_node)
+ x = error_mark_node;
+ else
+ x = fold_convert (TREE_TYPE (x), op0);
+ break;
+
case POSTDECREMENT_EXPR:
case POSTINCREMENT_EXPR:
case INIT_EXPR: