[Bug c++/57746] rejected valid specialization of member function of class template (I think)
luto at mit dot edu
gcc-bugzilla@gcc.gnu.org
Tue Jul 2 00:04:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57746
--- Comment #4 from Andy Lutomirski <luto at mit dot edu> ---
Daniel, I'm unconvinced that your interpretation is the intended one.
[temp.explicit].4 says "A declaration of [list including member function] ... A
definition of [list not including member function]". If definitions were
intended to be declarations in this context, then the second part would be
redundant, I think.
Regardless, the interesting case is:
template<typename T>
struct X
{
static int val;
static void func();
};
// optionally: extern template struct X<int>;
void something()
{
X<int>::func();
}
in one file and
struct X
{
static int val;
static void func();
};
template<> void X<int>::func() {}
in another. I don't think this is an odr violation, since there is only one
definition of anything that could be confused with X<int>::func. g++ will
happily compile and link it (without the extern template bit) and it will work.
It is supposed to? Could a conforming compiler mangle the specialized version
of func differently?
More information about the Gcc-bugs
mailing list