public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "reichelt at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/21768] New: [3.4/4.0/4.1 regression] ICE in error message due to violation of coding conventions Date: Thu, 26 May 2005 14:50:00 -0000 [thread overview] Message-ID: <20050526144535.21768.reichelt@gcc.gnu.org> (raw) [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 3081 bytes --] Compiling the following code snippet with the German locale enabled causes an ICE: ================================ template<int,int> struct A; template<int> struct A {}; ================================ bug.cc:1: Fehler: previous declaration »template<int <anonymous>, int <anonymous> > struct A« bug.cc:2: Fehler: 2 Template-Parameter bug.cc:2: interner Compiler-Fehler: in pp_base_format_text, bei pretty-print.c:357 Bitte senden Sie einen vollständigen Fehlerbericht auf Englisch ein; bearbeiten Sie die Quellen zunächst mit einem Präprozessor, wenn es dienlich ist. Fehler in der deutschen Übersetzung sind an de@li.org zu melden. Gehen Sie gemäß den Hinweisen in <URL:http://gcc.gnu.org/bugs.html> vor. This is partly due to the fact that the code snippet in cp/pt.c that generates the original message violates the coding conventions (see http://www.gnu.org/prep/standards/standards.html#Internationalization): error ("used %d template parameter%s instead of %d", TREE_VEC_LENGTH (tmpl_parms), TREE_VEC_LENGTH (tmpl_parms) == 1 ? "" : "s", TREE_VEC_LENGTH (parms)); The patch below fixes that by removing the conditional and using "parameter(s)" in the text. This should simplify i18n efforts. ============================================================================= --- gcc/gcc/cp/pt.c 2005-05-25 00:00:57.000000000 +0200 +++ gcc/gcc/cp/pt.c 2005-05-25 00:35:03.000000000 +0200 @@ -3225,10 +3225,9 @@ redeclare_class_template (tree type, tre if (TREE_VEC_LENGTH (parms) != TREE_VEC_LENGTH (tmpl_parms)) { cp_error_at ("previous declaration %qD", tmpl); - error ("used %d template parameter%s instead of %d", - TREE_VEC_LENGTH (tmpl_parms), - TREE_VEC_LENGTH (tmpl_parms) == 1 ? "" : "s", - TREE_VEC_LENGTH (parms)); + error ("used %d template parameter(s) instead of %d", + TREE_VEC_LENGTH (tmpl_parms), + TREE_VEC_LENGTH (parms)); return; } ============================================================================= Alternatively, one could make two messages, one for 1 parameter and one for 0 or more than 1. But I don't think that this is worthwhile. Btw, do all languages use the plural form for 0 parameters? That's an implicit assumption that might not be true. The ICE with the German locale appeared in gcc 3.4.4 (before we did not have a German translation for that error message). Therefore I'd like to apply the patch not only to mainline, but also to the 3.4 and 4.0 branch as a first step towards removing the ICE. -- Summary: [3.4/4.0/4.1 regression] ICE in error message due to violation of coding conventions Product: gcc Version: 4.1.0 Status: UNCONFIRMED Keywords: ice-on-invalid-code Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: reichelt at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21768
next reply other threads:[~2005-05-26 14:46 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2005-05-26 14:50 reichelt at gcc dot gnu dot org [this message] 2005-05-26 14:56 ` [Bug c++/21768] " reichelt at gcc dot gnu dot org 2005-05-26 15:47 ` pinskia at gcc dot gnu dot org 2005-05-26 16:10 ` cvs-commit at gcc dot gnu dot org 2005-05-26 16:14 ` cvs-commit at gcc dot gnu dot org 2005-05-26 16:17 ` cvs-commit at gcc dot gnu dot org 2005-05-26 16:41 ` reichelt at gcc dot gnu dot org 2005-05-26 16:56 ` reichelt at gcc dot gnu dot org 2005-06-29 14:02 ` [Bug c++/21768] [3.4 " reichelt at gcc dot gnu dot org 2005-07-04 9:53 ` [Bug translation/21768] " reichelt at gcc dot gnu dot org 2005-08-31 13:47 ` bonzini at gcc dot gnu dot org 2005-08-31 15:43 ` reichelt at igpm dot rwth-aachen dot de
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=20050526144535.21768.reichelt@gcc.gnu.org \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@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: linkBe 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).