I am trying to understand the below code snippet
template <typename T>
class testopaque {
public:
void test(T var = T()) {}
};
How does the default argument work when called with a pointer type example int *
int main() {
testopaque<int *> obj1;
obj1.test();
}
what would the compiler generate when obj1.test() is called. I get a compiler error when I try
int main() {
int * var = int *();
}
error: expected primary-expression before ‘int’
int * ptr = int *();