From: Simon Martin <simartin@users.sourceforge.net>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: [PATCH] Fix PR c++/42054: ICE with invalid template parameter
Date: Sun, 22 Nov 2009 21:51:00 -0000 [thread overview]
Message-ID: <4B09B1E9.3020700@users.sourceforge.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 449 bytes --]
Hello,
The following invalid snippet causes an ICE with gcc >= 4.3
=== cut here ===
template<int int> struct A;
template<int int> struct A;
=== cut here ===
This is due to 'redeclare_class_template' not handling cases with an
invalid template argument. The attached patch fixes this by skipping
invalid template arguments.
I have successfully regtested it on 86_64-apple-darwin-9. Is it OK
for trunk?
Best regards,
Simon
:ADDPATCH c++:
[-- Attachment #2: CL_42054 --]
[-- Type: text/plain, Size: 148 bytes --]
2009-11-22 Simon Martin <simartin@users.sourceforge.net>
PR c++/42054
* pt.c (redeclare_class_template): Skip erroneous template parameters.
[-- Attachment #3: pr42054.patch --]
[-- Type: text/plain, Size: 408 bytes --]
Index: gcc/cp/pt.c
===================================================================
--- gcc/cp/pt.c (revision 154425)
+++ gcc/cp/pt.c (working copy)
@@ -4565,7 +4565,8 @@
return false;
}
- if (tmpl_default != NULL_TREE && parm_default != NULL_TREE)
+ if (tmpl_parm != error_mark_node
+ && tmpl_default != NULL_TREE && parm_default != NULL_TREE)
{
/* We have in [temp.param]:
[-- Attachment #4: CL_42054_testsuite --]
[-- Type: text/plain, Size: 114 bytes --]
2009-11-21 Simon Martin <simartin@users.sourceforge.net>
PR c++/42054:
* g++.dg/parse/error37.C: New test.
[-- Attachment #5: error37.C --]
[-- Type: text/plain, Size: 170 bytes --]
/* PR c++/42054 */
/* { dg-do "compile" } */
template<int int> struct A; /* { dg-error "two or more" } */
template<int int> struct A; /* { dg-error "two or more" } */
next reply other threads:[~2009-11-22 21:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-22 21:51 Simon Martin [this message]
2009-11-22 22:36 ` Gabriel Dos Reis
2009-11-28 16:39 ` Simon Martin
2009-12-20 20:14 ` Simon Martin
2010-02-19 20:11 ` [PING^2, PATCH] " Simon Martin
2010-02-23 5:01 ` [PATCH] " Jason Merrill
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B09B1E9.3020700@users.sourceforge.net \
--to=simartin@users.sourceforge.net \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).