Template function specialization
Ryszard Kabatek
Ryszard.Kabatek@softax.pl
Thu Apr 5 02:58:00 GMT 2001
Trying to compile the source below I get
the folowing error messages:
spec.cc:16: non-template used as template
spec.cc:16: syntax error before `{' token
If I change the line 16
from
std::swap(MySpace::X& lhs, MySpace::X& rhs)
to
std::swap<>(MySpace::X& lhs, MySpace::X& rhs)
the source compiles well.
As far as I know the original version should compile.
I am supposing a compiler bug. I am right?
I am using gcc version 3.0 20010402 (prerelease)
on RedHat Linux 7.0, PIII.
Regards
--
Ryszard Kabatek
// spec.cc
#include <algorithm>
namespace MySpace {
class X {
public:
void swap(X&) {}
};
} // MySpace
template<>
void
std::swap(MySpace::X& lhs, MySpace::X& rhs)
{
lhs.swap(rhs);
}
More information about the Gcc
mailing list