Before the patch, the compiler would crash for the test due to inconsistent linkage.
This patch tries to avoid it by make the linkage consistent for template and its specialization. After the patch, the behavior of compiler would be partially correct for the case.
The correct one is:
export template<class T> void f() {} template<> void f<int>() {}
In this case, the linkage for both declaration should be external (the wording I get by consulting in WG21 is "the linkage for name f should be external").
And for the case:
template<class T> void f() {} export template<> void f<int>() {}
Compiler should reject it. This isn't done now. I marked it as FIXME in the test. After all, this patch would stop a crash.
Maybe use EXPECT_EQ to get better error messages if this fails (that way the error message can include the values - whereas written with TRUE+== the error message can only include "false") - similarly with the size() == 2, prefer EXPECT_EQ(size(), 2)