I am getting an error qualified-id in declaration before ‘<’ token from the following code:
// g++ -std=c++20 example.cpp
#include <iostream>
template <typename U = int>
struct Example {
template <typename T>
static void execute() {
std::cout << "Hey" << std::endl;
}
};
int main() {
Example::execute<float>();
}
When I include the type for Example, such as Example<int>::execute<float>() it compiles successfully. Shouldn't the compiler be able to deduce the type since I specified it as default value?