aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2010-01-20 20:58:53 -0500
committerJason Merrill <jason@gcc.gnu.org>2010-01-20 20:58:53 -0500
commit4d43dcdeb57d58ad5e3aade44b93fa48d051c770 (patch)
tree7f36d32b649117c432fd4d50913d0ac71b47d393 /gcc/cp
parentf827f65933319275c46eccf2aa1df4f1d21d6783 (diff)
downloadgcc-4d43dcdeb57d58ad5e3aade44b93fa48d051c770.zip
gcc-4d43dcdeb57d58ad5e3aade44b93fa48d051c770.tar.gz
gcc-4d43dcdeb57d58ad5e3aade44b93fa48d051c770.tar.bz2
re PR c++/42338 ([c++0x] ICE on decltype usage with templates)
PR c++/42338 * mangle.c (write_expression): Handle tree codes that have extra arguments in the middle-end. * cp-demangle.c (d_print_comp): Fix array index printing. From-SVN: r156103
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/mangle.c24
2 files changed, 28 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 5f7190e..a6a3eb2 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2010-01-20 Jason Merrill <jason@redhat.com>
+
+ PR c++/42338
+ * mangle.c (write_expression): Handle tree codes that have extra
+ arguments in the middle-end.
+
2010-01-20 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/42038
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 13b0ed4..7e4cf66 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -2481,7 +2481,7 @@ write_expression (tree expr)
}
else
{
- int i;
+ int i, len;
const char *name;
/* When we bind a variable or function to a non-type template
@@ -2582,7 +2582,27 @@ write_expression (tree expr)
break;
default:
- for (i = 0; i < TREE_OPERAND_LENGTH (expr); ++i)
+ /* In the middle-end, some expressions have more operands than
+ they do in templates (and mangling). */
+ switch (code)
+ {
+ case PREINCREMENT_EXPR:
+ case PREDECREMENT_EXPR:
+ case POSTINCREMENT_EXPR:
+ case POSTDECREMENT_EXPR:
+ len = 1;
+ break;
+
+ case ARRAY_REF:
+ len = 2;
+ break;
+
+ default:
+ len = TREE_OPERAND_LENGTH (expr);
+ break;
+ }
+
+ for (i = 0; i < len; ++i)
{
tree operand = TREE_OPERAND (expr, i);
/* As a GNU extension, the middle operand of a