Though it is an old and outdated question, it may worth noting that C++11 had solved this issue using deleted functions:
template<typename T>
T GetGlobal(const char *name) = delete;
template<>
int GetGlobal<int>(const char *name);
UPDATE
This will not compile under MacOS llvm 8.
It is due to a still hanging 4 years old defect (see this bug report).
The following workaround will fit the issue (using a static_assert construct).
template<typename T>
T GetGlobal(const char *name) {
static_assert(sizeof(T) == 0, "Only specializations of GetGlobal can be used");
}
template<>
int GetGlobal<int>(const char *name);
UPDATE
Visual studio 15.9 has the same bug. Use the previous workaround for it.