Skip to content

Instantly share code, notes, and snippets.

@dascandy
Last active August 18, 2016 09:59
Show Gist options
  • Select an option

  • Save dascandy/ede4ba88c20ce5523eee303fe9748571 to your computer and use it in GitHub Desktop.

Select an option

Save dascandy/ede4ba88c20ce5523eee303fe9748571 to your computer and use it in GitHub Desktop.
#include <stdio.h>
const char* GetCompilerVersion() {
return "GCC/Clang (working)";
}
template <typename T>
class X {
public:
static const char* GetCompilerVersion() {
return "MSVC (broken)";
}
};
template <typename T>
class Y : public X<T> {
public:
const char* GetCompiler() {
return GetCompilerVersion();
}
};
int main() {
printf("using compiler %s\n", Y<int>().GetCompiler());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment