Bug 8116 - [3.2 regression] ICE in member template function
Summary: [3.2 regression] ICE in member template function
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2002-10-02 00:06 UTC by yuvalk
Modified: 2003-07-25 17:33 UTC (History)
5 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description yuvalk 2002-10-02 00:06:00 UTC
When compiling this small file I get the following message:
...........................................................
tmplbug.cpp: In function `void fff()':
tmplbug.cpp:16: Internal compiler error in tsubst_decl, at cp/pt.c:5648
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
...........................................................
This also happens if the template function is the constructor
of com_ptr.  In fact, any template function inside a template
causes an ICE when it is called.
GCC 2.95.3 compiles this code with no errors or warnings.

Release:
3.2

Environment:
System: Linux twins 2.4.18-3custom #1 SMP Thu Sep 19 12:30:28 IDT 2002 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-3.2/configure --prefix=/usr/gcc/3.2 --enable-languages=c,c++

How-To-Repeat:
/*********************************************/
/* Compile the following with `gcc -c x.cpp' */
/*********************************************/
template <class T>
struct MY_PLACEHOLDER {
	static int m_iid;
};

template <const int* iid>
class com_ptr {
public:
	com_ptr() { }
	template<typename Q> bool operator==(Q p){return 1;}
};

void fff()
{
        com_ptr<&MY_PLACEHOLDER<int>::m_iid> A;
        if(A==2){}
}
/*********************************************/
Comment 1 Kriang Lerdsuwanakij 2002-10-27 06:48:46 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed as a regression from GCC 3.0.  The bug is fixed in the main line.
Comment 2 Volker Reichelt 2002-10-27 18:29:45 UTC
From: Reichelt <reichelt@igpm.rwth-aachen.de>
To: gcc-gnats@gcc.gnu.org, yuvalk@mainsoft.com, gcc-bugs@gcc.gnu.org,
        nobody@gcc.gnu.org
Cc:  
Subject: Re: c++/8116: ICE in member template function
Date: Sun, 27 Oct 2002 18:29:45 +0200

 Hi,
 
 here's a little cleaned-up testcase:
 
 ---------------------snip here------------------------
 template <typename T> struct A { static int i; };
 
 template <int*> struct B
 {
     template <typename U> void bar(U);
 };
 
 void foo()
 {
     B<&A<int>::i>().bar(0);
 }
 ---------------------snip here------------------------
 
 Greetings,
 Volker
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8116
 
 

Comment 3 janis187 2002-12-23 11:45:37 UTC
From: Janis Johnson <janis187@us.ibm.com>
To: gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, yuvalk@mainsoft.com,
   gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org
Cc:  
Subject: Re: c++/8116: [3.2 regression] ICE in member template function
Date: Mon, 23 Dec 2002 11:45:37 -0800

 The patch that fixed the regression reported in PR c++/8116
 was fixed with the following patch to the mainline:
 
 2002-09-16  Nathan Sidwell  <nathan@codesourcery.com>
 
         PR c++/7718
         * pt.c (tsubst_decl): Remove assert.
 
 PR 8116 is a duplicate of PR 7718.  They are both
 regressions from GCC 3.0.4 that still exist on the 3.2
 branch.  PR 7718 was not recognized as a regression.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8116
 
 
 
Comment 4 Joe Buck 2003-04-25 21:20:19 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed for 3.3.