why is this short snippet of template code valid?

Viewed 181

As per the title, I do not understand how can the following code compile when has_type_struct<no_type> is certainly an invalid type.

template<typename T>
using my_int = int;

struct no_type {};

template<typename T>
struct has_type_struct { using type = typename T::type; };

template<typename T>
using has_type_using = typename T::type;

int main() {
   my_int<has_type_struct<no_type>> a; // why does this compile?
   //my_int<has_type_using<no_type>>(); // this rightfully does not compile
   return 0;
}
1 Answers
Related