3 ms·
I'm sure you know better, but at first glance this seems wrong. Reason: `main` is not itself a template, so `cast` is not a dependent name. C++ compilers used
by nzmsv 6y ago
I'm sure you know better, but at first glance this seems wrong. Reason: `main` is not itself a template, so `cast` is not a dependent name.
C++ compilers used to be liberal about accepting unnecessary instances of the `typename` keyword so lots of people would just sprinkle them everywhere. Modern versions of both Clang and GCC call this out.
The actual rule: https://en.cppreference.com/w/cpp/language/dependent_name#The_typename_disambiguator_for_dependent_names https://en.cppreference.com/w/cpp/language/dependent_name#Th...
- vbarrielle 6y agoYou're right, since I'm frequently using templated functions I encounter this issue quite often, but here when I wanted to give an example I forgot I needed to be in a dependent context. I guess I'd better test my example next time I want to give one...