I saw this answer to a question on SO related to the declaration for a default constructor of a class template that said that the following code is not valid C++ due to CWG1435:
template <class T> class Stack {
public:
Stack<T>(); //IS THIS VALID?
};
While another answer said that the above example is valid C++. There are 2 sources for the claim that the above example is valid:
Otherwise, it is treated as a type-name, and is equivalent to the template-name followed by the template-parameters of the class template enclosed in <>
- In a CppCon conference Dan Saks basically showed a very similar example.
So as we can see the two linked answers make opposite claims and i don't know which one is correct. So my question is which of the two answers is correct. That is, is the declaration Stack<T>(); valid C++ or not.
PS: I am asking my question for Modern C++ meaning from C++11 & onwards.