public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19980] New: [4.0 regression] ICE on invalid template declaration
@ 2005-02-15 23:15 reichelt at gcc dot gnu dot org
  2005-02-15 23:17 ` [Bug c++/19980] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-02-15 23:15 UTC (permalink / raw)
  To: gcc-bugs

The following invalid code snippet causes an ICE on mainline:

============================
int foo;
template<int> void foo() {}
============================

The error message reads:

  bug.cc:2: error: 'template<int <anonymous> > void foo()' redeclared as
different kind of symbol
  bug.cc:1: error: previous declaration of 'int foo'


  Internal compiler error: Error reporting routines re-entered.
  Please submit a full bug report, [etc.]


The following patch fixes the problem for me.
I haven't done any regtesting, though.

===================================================================
--- gcc/gcc/cp/decl.c	27 Jan 2005 07:32:20 -0000	1.1355
+++ gcc/gcc/cp/decl.c	15 Feb 2005 19:18:28 -0000
@@ -9917,7 +9917,11 @@ start_preparsed_function (tree decl1, tr
      class scope, current_class_type will be NULL_TREE until set above
      by push_nested_class.)  */
   if (processing_template_decl)
-    decl1 = push_template_decl (decl1);
+    {
+      tree newdecl1 = push_template_decl (decl1);
+      if (newdecl1 != error_mark_node)
+        decl1 = newdecl1;
+    }
 
   /* We are now in the scope of the function being defined.  */
   current_function_decl = decl1;
===================================================================

-- 
           Summary: [4.0 regression] ICE on invalid template declaration
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code, error-recovery, monitored
          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=19980


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/19980] [4.0 regression] ICE on invalid template declaration
  2005-02-15 23:15 [Bug c++/19980] New: [4.0 regression] ICE on invalid template declaration reichelt at gcc dot gnu dot org
@ 2005-02-15 23:17 ` pinskia at gcc dot gnu dot org
  2005-02-20  4:31 ` reichelt at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-15 23:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-15 19:50 -------
Confirmed:
: Search converges between 2004-02-01-trunk (#445) and 2004-03-01-trunk (#446).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-02-15 19:50:27
               date|                            |
   Target Milestone|---                         |4.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19980


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/19980] [4.0 regression] ICE on invalid template declaration
  2005-02-15 23:15 [Bug c++/19980] New: [4.0 regression] ICE on invalid template declaration reichelt at gcc dot gnu dot org
  2005-02-15 23:17 ` [Bug c++/19980] " pinskia at gcc dot gnu dot org
@ 2005-02-20  4:31 ` reichelt at gcc dot gnu dot org
  2005-03-20 17:01 ` [Bug c++/19980] [4.0/4.1 " pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-02-20  4:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2005-02-19 21:04 -------
Patch here:
http://gcc.gnu.org/ml/gcc-patches/2005-02/msg01132.html

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |reichelt at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
           Keywords|                            |patch


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19980


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/19980] [4.0/4.1 regression] ICE on invalid template declaration
  2005-02-15 23:15 [Bug c++/19980] New: [4.0 regression] ICE on invalid template declaration reichelt at gcc dot gnu dot org
  2005-02-15 23:17 ` [Bug c++/19980] " pinskia at gcc dot gnu dot org
  2005-02-20  4:31 ` reichelt at gcc dot gnu dot org
@ 2005-03-20 17:01 ` pinskia at gcc dot gnu dot org
  2005-03-22 15:07 ` cvs-commit at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-20 17:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-03-20 17:01 -------
"But, that's too complicated for Stage 3. Your patch is OK."



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19980


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/19980] [4.0/4.1 regression] ICE on invalid template declaration
  2005-02-15 23:15 [Bug c++/19980] New: [4.0 regression] ICE on invalid template declaration reichelt at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-03-20 17:01 ` [Bug c++/19980] [4.0/4.1 " pinskia at gcc dot gnu dot org
@ 2005-03-22 15:07 ` cvs-commit at gcc dot gnu dot org
  2005-03-22 15:13 ` cvs-commit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-03-22 15:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-03-22 15:07 -------
Subject: Bug 19980

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	reichelt@gcc.gnu.org	2005-03-22 15:07:04

Modified files:
	gcc/cp         : ChangeLog decl.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/template: redecl3.C 

Log message:
	PR c++/19980
	* decl.c (start_preparsed_function): Robustify.
	
	* g++.dg/template/redecl3.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4672&r2=1.4673
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1380&r2=1.1381
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5195&r2=1.5196
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/redecl3.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19980


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/19980] [4.0/4.1 regression] ICE on invalid template declaration
  2005-02-15 23:15 [Bug c++/19980] New: [4.0 regression] ICE on invalid template declaration reichelt at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2005-03-22 15:07 ` cvs-commit at gcc dot gnu dot org
@ 2005-03-22 15:13 ` cvs-commit at gcc dot gnu dot org
  2005-03-22 15:15 ` reichelt at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-03-22 15:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-03-22 15:13 -------
Subject: Bug 19980

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	reichelt@gcc.gnu.org	2005-03-22 15:13:35

Modified files:
	gcc/cp         : ChangeLog decl.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/template: redecl3.C 

Log message:
	PR c++/19980
	* decl.c (start_preparsed_function): Robustify.
	
	* g++.dg/template/redecl3.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.4648.2.16&r2=1.4648.2.17
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1371.2.4&r2=1.1371.2.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.61&r2=1.5084.2.62
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/redecl3.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19980


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/19980] [4.0/4.1 regression] ICE on invalid template declaration
  2005-02-15 23:15 [Bug c++/19980] New: [4.0 regression] ICE on invalid template declaration reichelt at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2005-03-22 15:13 ` cvs-commit at gcc dot gnu dot org
@ 2005-03-22 15:15 ` reichelt at gcc dot gnu dot org
  2005-03-22 15:37 ` pcarlini at suse dot de
  2005-03-22 15:54 ` reichelt at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-03-22 15:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2005-03-22 15:15 -------
Fixed.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19980


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/19980] [4.0/4.1 regression] ICE on invalid template declaration
  2005-02-15 23:15 [Bug c++/19980] New: [4.0 regression] ICE on invalid template declaration reichelt at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2005-03-22 15:15 ` reichelt at gcc dot gnu dot org
@ 2005-03-22 15:37 ` pcarlini at suse dot de
  2005-03-22 15:54 ` reichelt at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pcarlini at suse dot de @ 2005-03-22 15:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2005-03-22 15:36 -------
Hi Volker: probably your patch fixes c++/20443 too! Can you check?

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19980


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/19980] [4.0/4.1 regression] ICE on invalid template declaration
  2005-02-15 23:15 [Bug c++/19980] New: [4.0 regression] ICE on invalid template declaration reichelt at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2005-03-22 15:37 ` pcarlini at suse dot de
@ 2005-03-22 15:54 ` reichelt at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-03-22 15:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2005-03-22 15:54 -------
*** Bug 20443 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wwieser at gmx dot de


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19980


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-03-22 15:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-15 23:15 [Bug c++/19980] New: [4.0 regression] ICE on invalid template declaration reichelt at gcc dot gnu dot org
2005-02-15 23:17 ` [Bug c++/19980] " pinskia at gcc dot gnu dot org
2005-02-20  4:31 ` reichelt at gcc dot gnu dot org
2005-03-20 17:01 ` [Bug c++/19980] [4.0/4.1 " pinskia at gcc dot gnu dot org
2005-03-22 15:07 ` cvs-commit at gcc dot gnu dot org
2005-03-22 15:13 ` cvs-commit at gcc dot gnu dot org
2005-03-22 15:15 ` reichelt at gcc dot gnu dot org
2005-03-22 15:37 ` pcarlini at suse dot de
2005-03-22 15:54 ` reichelt at gcc dot gnu dot org

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).