#include template struct void_template { typedef void type; }; template using void_template_alias = void; template struct fun_template { void print() const { std::cout << "unspecialized" << std::endl; } }; template struct fun_template::type> { void print() const { std::cout << "void" << std::endl; } }; template struct fun_template_alias { void print() const { std::cout << "unspecialized" << std::endl; } }; template struct fun_template_alias> { void print() const { std::cout << "void" << std::endl; } }; template struct hard_error { static_assert(sizeof(T) == 0, "Your expectations never hold"); }; template struct soft_error {}; int main(int argc, char** argv) { // plain template, hard error case // expected: compilation error // GCC 4.8.1: compilation error fun_template>{}.print(); // template alias, hard error case // expected: compilation error // GCC 4.8.1: "void" fun_template_alias>{}.print(); // plain template, soft error case // expected: "unspecialized" // GCC 4.8.1: "unspecialized" fun_template>{}.print(); // template alias, soft error case // expected: "unspecialized" // GCC 4.8.1: "void" fun_template_alias>{}.print(); return 0; }