struct foo {
template<bool b>
void f();
template<typename T, bool b>
void g();
};
template<>
void foo::f<true>() {}
template<>
void foo::f<false>() {}
template<typename T>
void foo::g<T, true>() {}
template<typename T>
void foo::g<T, false>() {}
gets you:
~/ootbc/members/src$ g++ foo.cc
foo.cc:13: error: partial specialization `g<T, true>' of function template
foo.cc:13: error: got 1 template parameters for `void foo::g()'
foo.cc:13: error: but 2 required
foo.cc:15: error: partial specialization `g<T, false>' of function template
foo.cc:15: error: redefinition of `void foo::g()'
foo.cc:13: error: `void foo::g()' previously declared here
foo.cc:15: error: got 1 template parameters for `void foo::g()'
foo.cc:15: error: but 2 required
The error message is hosed, because there are in fact two parameters. Not sure
whether the code is valid or not (but it should be :-)
--
Summary: Is this right?
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: igodard at pacbell dot net
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23823