Maybe you guys missed it, but Brian Bi already gave the authoritative answer in this thread: "This is a known issue and needs a paper to fix."
(Brian, is there any prior discussion — a CWG issue, any old papers, etc.?)
template <typename T> int x;
template <typename T> int f();
template<> extern int x<int>;
template<> extern int f<int>();
int f() {
return x<int> + x<long>;
}
template <>
int x<int> = 4;
template <>
int f<int>() { return 4; }
Clang trunk already accepts this syntax, with a warning that it's non-standard.
GCC, EDG, and MSVC all reject: `template<> extern [...]` isn't allowed because the grammar for a template specialization doesn't include storage-class for some historical reason (
[temp.expl.spec]/2).
Seems like a good idea to me, FWIW; but going back and forth on this mailing list isn't going to change the status quo. "This is a known issue and needs a paper to fix."
–Arthur