First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 8660
Product:  
Component:  
Status: RESOLVED
Resolution: FIXED
Assigned To: Jason Merrill <jason@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: martin.dorey@bluearc.com
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 8660 depends on: Show dependency tree
Show dependency graph
Bug 8660 blocks:

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: Opened: 2002-11-20 10:46
trevithick:~/stingray/test/data_structures$ gcc-3.2 -v -c -W -Wall -pedantic
--save-temps bug0.cpp 
Reading specs from /usr/lib/gcc-lib/i386-linux/3.2.1/specs
Configured with: /home/packages/gcc/3.2/gcc-3.2-3.2.1ds5/src/configure -v
--enable-languages=c,c++,java,f77,proto,objc,ada --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib
--enable-nls --without-included-gettext --enable-__cxa_atexit
--enable-clocale=gnu --enable-java-gc=boehm --enable-objc-gc i386-linux
Thread model: posix
gcc version 3.2.1 20021111 (Debian prerelease)
 /usr/lib/gcc-lib/i386-linux/3.2.1/cpp0 -lang-c++ -D__GNUG__=3 -D__DEPRECATED
-D__EXCEPTIONS -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=1
-D__GXX_ABI_VERSION=102 -D__ELF__ -Dunix -D__gnu_linux__ -Dlinux -D__ELF__
-D__unix__ -D__gnu_linux__ -D__linux__ -D__unix -D__linux -Asystem=posix
-D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_GNU_SOURCE -Acpu=i386 -Amachine=i386
-Di386 -D__i386 -D__i386__ -D__tune_i386__ bug0.cpp -W -Wall -pedantic bug0.ii
GNU CPP version 3.2.1 20021111 (Debian prerelease) (cpplib) (i386 Linux/ELF)
ignoring nonexistent directory "/usr/i386-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/3.2
 /usr/include/c++/3.2/i386-linux
 /usr/include/c++/3.2/backward
 /usr/local/include
 /usr/lib/gcc-lib/i386-linux/3.2.1/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i386-linux/3.2.1/cc1plus -fpreprocessed bug0.ii -quiet
-dumpbase bug0.cpp -W -Wall -pedantic -version -o bug0.s
GNU CPP version 3.2.1 20021111 (Debian prerelease) (cpplib) (i386 Linux/ELF)
GNU C++ version 3.2.1 20021111 (Debian prerelease) (i386-linux)
        compiled by GNU C version 3.2.1 20021111 (Debian prerelease).
bug0.cpp: In member function `void BadgerBuf::ReadPod() [with B = int]':
bug0.cpp:10:   instantiated from here
bug0.cpp:10: Internal compiler error in tsubst_expr, at cp/pt.c:7644
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

Release:
GNU C++ version 3.2.1 20021111 (Debian prerelease) (i386-linux)

Environment:
Linux trevithick 2.4.16 #2 Mon Dec 10 15:54:50 GMT 2001 i686 unknown unknown
GNU/Linux

How-To-Repeat:
Source is:

struct BadgerBuf
{
  void ReadPod();
  template<class B>
  void ReadPod();
};

void BadgerBuf::ReadPod ()
  { ReadPod<int> (); }

Adding this-> to the call to ReadPod<int> doesn't change the behaviour.  Nor
does "this->template ".  Putting brackets round the (ReadPod<int>) part causes
a different error:

bug0.cpp: In member function `void BadgerBuf::ReadPod()':
bug0.cpp:10: internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

Swapping the order of the declarations avoids the problem.  Unless you've left
the brackets around (ReadPod<int>) in which case it still segfaults.

If you leave the declarations swapped but add another template between the
class definition and the function definition, like so:

struct BadgerBuf
{
  template<class B>
  void ReadPod();
  void ReadPod();
};

template <class T>
struct Predicate 
  {};

void BadgerBuf::ReadPod ()
  { ReadPod<int> (); }

Then you get different behaviour again:

bug0.cpp: In member function `void BadgerBuf::ReadPod()':
bug0.cpp:14: parse error before `>' token

Perhaps I should have submitted these as separate bugs - but I can always do
that later if they turn out to be unrelated.

------- Comment #1 From Wolfgang Bangerth 2002-11-20 11:05 -------
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed. At least one case has been fixed on mainline
    in the meantime (but is still present in 3.2.1), namely the
    last one you mention (with parentheses, declarations swapped):
    struct BadgerBuf
    {
        template<class B>
        void ReadPod();
        void ReadPod();
    };
    
    void BadgerBuf::ReadPod ()
    { (ReadPod<int>) (); }
    
    However, the other ICEs still exist.
    
    I can reproduce all these ICEs with 2.95, so it is not a
    regression, although I would love to see this fixed soon
    anyway since it seems like a not so uncommon idiom.

------- Comment #2 From Volker Reichelt 2003-01-22 12:08 -------
From: Volker Reichelt <reichelt@igpm.rwth-aachen.de>
To: gcc-gnats@gcc.gnu.org, martin.dorey@bluearc.com, gcc-bugs@gcc.gnu.org
Cc:  
Subject: Re: c++/8660: template overloading ICE in tsubst_expr, at cp/pt.c:7644
Date: Wed, 22 Jan 2003 12:08:47 +0100

 Two bugs (the one with the parentheses, and the one with the additional
 template) have been fixed in 3.3 branch and mainline.
 
 That leaves us with the first ICE. This, however is a regression, since
 gcc 3.0.x did compile the code (gcc issued an ICE, though).
 
 Regards,
 Volker
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8660
 
 

------- Comment #3 From Jason Merrill 2003-03-10 22:49 -------
Responsible-Changed-From-To: unassigned->jason
Responsible-Changed-Why: got it

------- Comment #4 From Jason Merrill 2003-03-11 10:33 -------
From: jason@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/8660
Date: 11 Mar 2003 10:33:29 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	jason@gcc.gnu.org	2003-03-11 10:33:29
 
 Modified files:
 	gcc/cp         : ChangeLog decl2.c 
 
 Log message:
 	PR c++/8660
 	* decl2.c (check_classfn): A member template only matches a
 	member template.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3260&r2=1.3261
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl2.c.diff?cvsroot=gcc&r1=1.602&r2=1.603
 


------- Comment #5 From Jason Merrill 2003-03-11 10:34 -------
From: jason@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/8660
Date: 11 Mar 2003 10:34:10 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_3-branch
 Changes by:	jason@gcc.gnu.org	2003-03-11 10:34:10
 
 Modified files:
 	gcc/cp         : ChangeLog decl2.c 
 
 Log message:
 	PR c++/8660
 	* decl2.c (check_classfn): A member template only matches a
 	member template.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.73&r2=1.3076.2.74
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl2.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.575.2.14&r2=1.575.2.15
 


------- Comment #6 From Jason Merrill 2003-03-11 10:34 -------
From: jason@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/8660
Date: 11 Mar 2003 10:34:31 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	jason@gcc.gnu.org	2003-03-11 10:34:31
 
 Added files:
 	gcc/testsuite/g++.dg/template: member2.C 
 
 Log message:
 	PR c++/8660
 	* decl2.c (check_classfn): A member template only matches a
 	member template.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/member2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 


------- Comment #7 From Jason Merrill 2003-03-11 10:34 -------
From: jason@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/8660
Date: 11 Mar 2003 10:34:45 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	jason@gcc.gnu.org	2003-03-11 10:34:45
 
 Modified files:
 	gcc/testsuite/g++.old-deja/g++.mike: err1.C 
 
 Log message:
 	PR c++/8660
 	* decl2.c (check_classfn): A member template only matches a
 	member template.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.mike/err1.C.diff?cvsroot=gcc&r1=1.2&r2=1.3
 


------- Comment #8 From Jason Merrill 2003-03-11 10:35 -------
From: jason@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/8660
Date: 11 Mar 2003 10:35:00 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_3-branch
 Changes by:	jason@gcc.gnu.org	2003-03-11 10:35:00
 
 Modified files:
 	gcc/testsuite/g++.old-deja/g++.mike: err1.C 
 
 Log message:
 	PR c++/8660
 	* decl2.c (check_classfn): A member template only matches a
 	member template.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.mike/err1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2&r2=1.2.74.1

------- Comment #9 From Jason Merrill 2003-03-11 10:35 -------
State-Changed-From-To: analyzed->closed
State-Changed-Why: fixed

First Last Prev Next    No search results available      Search page      Enter new bug