aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2005-08-24 10:21:46 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2005-08-24 10:21:46 +0000
commit863a331486b914ecc90a157198b0384b927e3f21 (patch)
treecbb233db998dd402e7725ba528b06dc7243f51dd
parentb9a6624012d373b43c70193b13fd226f7e5b4c24 (diff)
downloadgcc-863a331486b914ecc90a157198b0384b927e3f21.zip
gcc-863a331486b914ecc90a157198b0384b927e3f21.tar.gz
gcc-863a331486b914ecc90a157198b0384b927e3f21.tar.bz2
re PR c++/22454 (ICE with operator in default argument in template class)
cp: PR c++/22454 * parser.c (cp_lexer_peek_nth_token): Relax assert. testsuite: PR c++/22454 * g++.dg/parse/crash29.C: New. From-SVN: r103438
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/parser.c5
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/parse/crash29.C10
4 files changed, 23 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 305cf51..75c4500 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2005-08-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/22454
+ * parser.c (cp_lexer_peek_nth_token): Relax assert.
+
2005-08-23 Nathan Sidwell <nathan@codesourcery.com>
PR c++/23044
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 6eaf530..6712f00 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -497,14 +497,15 @@ cp_lexer_peek_nth_token (cp_lexer* lexer, size_t n)
cp_token *token;
/* N is 1-based, not zero-based. */
- gcc_assert (n > 0 && lexer->next_token != &eof_token);
-
+ gcc_assert (n > 0);
+
if (cp_lexer_debugging_p (lexer))
fprintf (cp_lexer_debug_stream,
"cp_lexer: peeking ahead %ld at token: ", (long)n);
--n;
token = lexer->next_token;
+ gcc_assert (!n || token != &eof_token);
while (n != 0)
{
++token;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index da7441dc..e787eaa 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2005-08-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/22454
+ * g++.dg/parse/crash29.C: New.
+
2005-08-23 DJ Delorie <dj@redhat.com>
* gcc.c-torture/execute/stdarg-2.c (main): Make sure long
diff --git a/gcc/testsuite/g++.dg/parse/crash29.C b/gcc/testsuite/g++.dg/parse/crash29.C
new file mode 100644
index 0000000..29ede04
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/crash29.C
@@ -0,0 +1,10 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 23 Aug 2005 <nathan@codesourcery.com>
+
+// PR 22454: ICE
+// Origin: Volker Reichelt reichelt@gcc.gnu.org
+
+template<int> struct A
+{
+ A(void* = &operator new);
+};