[Bug c++/13879] New: Error when doing an explicit specilization within a class
lifshitz at post dot tau dot ac dot il
gcc-bugzilla@gcc.gnu.org
Tue Jan 27 09:31:00 GMT 2004
code is (in file fact.cc):
// meta factorial - example for generative programming by James O. Coplien
// the Test class was added to demonstrate the gcc compilation error.
#include <stdio.h>
class Test {
public:
template<int n>
struct Fact
{
enum {RET = Fact<n-1>::RET*n};
};
template<>
struct Fact<0>
{
enum{RET = 1};
};
void Print()
{
printf("Fact<7>=%d\n", Fact<7>::RET);
}
};
int main()
{
Test t;
t.Print();
return 0;
}
command line:
gcc fact.cc
compilation error:
fact.cc:14: explicit specialization in non-namespace scope 'Test'
Note: the same code was compiled using sun compiler:
cc fact.cc
Both compilation and execution were successful.
--
Summary: Error when doing an explicit specilization within a
class
Product: gcc
Version: 2.95.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: lifshitz at post dot tau dot ac dot il
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: sparc-ultra5_10-sunOS5.8
GCC host triplet: sparc-ultra5_10-sunOS5.8
GCC target triplet: sparc-ultra5_10-sunOS5.8
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13879
More information about the Gcc-bugs
mailing list