[Bug c++/31378] New: "too few template-parameter-lists" when initializing static template member
trumsko at yahoo dot com
gcc-bugzilla@gcc.gnu.org
Tue Mar 27 18:43:00 GMT 2007
When compiling the following program the g++ 4.1.0 gives the error message:
"testtemplstatic.cpp:22: error: too few template-parameter-lists". Which I
interprete as a complaint, that a "template<>" is missing.
If I uncomment the "template<>" in line 21 g++ prints the error message:
"testtemplstatic.cpp:22: error: template header not allowed in member
definition of explicitly specialized class", which I interprete as having a
"template<>" too much.
One of the both versions (presumably the first) should be correct.
My configuration:
> g++ -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.1.0/configure
--prefix=/flc/flc03/data/samson/soft/gcc/4.1.0 --enable-languages=c,c++
Thread model: posix
gcc version 4.1.0
Regretfully I cannot check the bug with an 4.1.2 version of g++, as the
compilation of gcc 4.1.2 fails with an linker error on a Scientific Linux
(RHEL3) machine.
Cheers, T.
#include <iostream>
using namespace std;
template< class T >
struct foo
{
struct bar;
};
template<>
struct foo<int>::bar
{
const static char* blubb;
};
template struct foo<int>;
//template<>
const char* foo<int>::bar::blubb = "huhu";
int main()
{
cout << foo<int>::bar::blubb <<endl;
}
--
Summary: "too few template-parameter-lists" when initializing
static template member
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: trumsko at yahoo dot com
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31378
More information about the Gcc-bugs
mailing list