aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2002-12-03 06:52:25 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2002-12-03 06:52:25 +0000
commit5089de933887226dd53c04311170420f6c493638 (patch)
tree2274876a25ea75eb1e210cbc3a961b93d8d65b4e /gcc
parent35e058a2b83dee2fa1cbeebc226cc9a05b9ad6ef (diff)
downloadgcc-5089de933887226dd53c04311170420f6c493638.zip
gcc-5089de933887226dd53c04311170420f6c493638.tar.gz
gcc-5089de933887226dd53c04311170420f6c493638.tar.bz2
re PR c++/8720 (ICE with bitwise or (3 operands))
PR c++/8720 * spew.c (remove_last_token): Make sure that last_chunk is set correctly. PR c++/8615 * error.c (dump_expr): Handle character constants with TREE_OVERFLOW set. PR c++/8720 * g++.dg/parse/defarg1.C: New test. PR c++/8615 * g++.dg/template/char1.C: New test. From-SVN: r59757
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog10
-rw-r--r--gcc/cp/error.c5
-rw-r--r--gcc/cp/spew.c12
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/parse/defarg1.C5
-rw-r--r--gcc/testsuite/g++.dg/template/char1.C4
6 files changed, 36 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 2ade3e3..befdf12 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,13 @@
+2002-12-02 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/8720
+ * spew.c (remove_last_token): Make sure that last_chunk is set
+ correctly.
+
+ PR c++/8615
+ * error.c (dump_expr): Handle character constants with
+ TREE_OVERFLOW set.
+
2002-12-02 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
DR 180
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 872a556..495320d 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -1473,7 +1473,10 @@ dump_expr (t, flags)
else if (type == char_type_node)
{
output_add_character (scratch_buffer, '\'');
- dump_char (tree_low_cst (t, 0));
+ if (host_integerp (t, TREE_UNSIGNED (type)))
+ dump_char (tree_low_cst (t, TREE_UNSIGNED (type)));
+ else
+ output_printf (scratch_buffer, "\\x%x", TREE_INT_CST_LOW (t));
output_add_character (scratch_buffer, '\'');
}
else
diff --git a/gcc/cp/spew.c b/gcc/cp/spew.c
index 380d693..adc3ffd 100644
--- a/gcc/cp/spew.c
+++ b/gcc/cp/spew.c
@@ -1042,11 +1042,13 @@ remove_last_token (t)
t->last_pos--;
if (t->last_pos == 0 && t->last_chunk != t->tokens)
{
- struct token_chunk **tc;
- for (tc = &t->tokens; (*tc)->next != NULL; tc = &(*tc)->next)
- ;
- *tc = NULL;
- t->last_pos = ARRAY_SIZE ((*tc)->toks);
+ struct token_chunk *c;
+ c = t->tokens;
+ while (c->next != t->last_chunk)
+ c = c->next;
+ c->next = NULL;
+ t->last_chunk = c;
+ t->last_pos = ARRAY_SIZE (c->toks);
}
return result;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 68a874e..0c51391 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -4,6 +4,12 @@
2002-12-02 Mark Mitchell <mark@codesourcery.com>
+ PR c++/8720
+ * g++.dg/parse/defarg1.C: New test.
+
+ PR c++/8615
+ * g++.dg/template/char1.C: New test.
+
* g++.dg/template/varmod1.C: Fix typo.
2002-12-02 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
diff --git a/gcc/testsuite/g++.dg/parse/defarg1.C b/gcc/testsuite/g++.dg/parse/defarg1.C
new file mode 100644
index 0000000..77c50e8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/defarg1.C
@@ -0,0 +1,5 @@
+class A
+{
+public:
+ A(int nBits = ((int)0x8) | ((int)0x4) | ((int)0x2));
+};
diff --git a/gcc/testsuite/g++.dg/template/char1.C b/gcc/testsuite/g++.dg/template/char1.C
new file mode 100644
index 0000000..64ffda8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/char1.C
@@ -0,0 +1,4 @@
+template <class CharType, CharType line_terminator = 0>
+class String {};
+
+String<char, 255> s;