This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/8116: ICE in member template function
- From: yuvalk at mainsoft dot com
- To: gcc-gnats at gcc dot gnu dot org
- Cc: dekelc at mainsoft dot com, jluu at mainsoft dot com, zoharm at mainsoft dot com
- Date: Wed, 2 Oct 2002 10:01:27 +0300
- Subject: c++/8116: ICE in member template function
- Reply-to: yuvalk at mainsoft dot com
>Number: 8116
>Category: c++
>Synopsis: ICE in member template function
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: ice-on-legal-code
>Submitter-Id: net
>Arrival-Date: Wed Oct 02 00:06:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Yuval Kfir
>Release: 3.2
>Organization:
Mainsoft Co. Ltd.
>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++
>Description:
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.
>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){}
}
/*********************************************/
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: