This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
A bug with template templates
- To: gcc-bugs at gcc dot gnu dot org
- Subject: A bug with template templates
- From: "Marcin 'Qrczak' Kowalczyk" <qrczak at knm dot org dot pl>
- Date: Wed, 15 Dec 1999 12:26:14 +0100
[qrczak ~]$ g++ --version
2.95.1
(This is under Linux.)
------------------------------------------------------------------------
[qrczak ~]$ g++ -c bug1.cc
bug1.cc: In instantiation of `single<t1, int>()':
bug1.cc:3: instantiated from `single<template <class a> T1<a>, int>()'
bug1.cc:9: instantiated from here
bug1.cc:2: Internal compiler error.
bug1.cc:2: Please submit a full bug report.
bug1.cc:2: See <URL:http://www.gnu.org/software/gcc/faq.html#bugreport> for instructions.
[qrczak ~]$ cat bug1.cc
template<template<typename> class t1, typename t0> void single()
{
single<t1,t0>();
}
template<typename a> class T1 {};
int main()
{
single<T1,int>();
}
------------------------------------------------------------------------
I suppose that the following program is also correct, but g++ rejects it.
[qrczak ~]$ g++ -c bug2.cc
bug2.cc: In function `class T1<int> single<template <class a> T1<a>, int>()':
bug2.cc:9: instantiated from here
bug2.cc:3: `t1' is not a template
bug2.cc:3: no matching function for call to `single ()'
[qrczak ~]$ cat bug2.cc
template<template<typename> class t1, typename t0> t1<t0> single()
{
return single<t1,t0>();
}
template<typename a> class T1 {};
int main()
{
single<T1,int>();
}
--
__("< Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
\__/ GCS/M d- s+:-- a22 C+++>+++$ UL++>++++$ P+++ L++>++++$ E-
^^ W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP->+ t
QRCZAK 5? X- R tv-- b+>++ DI D- G+ e>++++ h! r--%>++ y-