These expressions are all definitions for normal types:
int num;
bool flag;
But some expression that looks like a definition for normal types unexpectedly turns out to be a declaration for templates(for details, see below and https://ibb.co/k0qCHp2)!
Here is the related code snippet(https://godbolt.org/z/a9W9Wc):
#include<iostream>
template<typename T>
class Test
{
public:
static constexpr int sdm = T(nullptr);
static int f(void){static_assert(sizeof(T)==0);}
int g(void){static_assert(sizeof(T)==0);}
};
int main()
{
Test<int> intTest; //**O'DWYER says that it's a declaration instead of a definition in his talk(see https://ibb.co/k0qCHp2)! Why?**
//But I can get this object's address indeed.
std::cout << &intTest << std::endl;
}
If Test<int> intTest; is a declaration, I can draw the conclusion that std::vector<int> vec; and std::map<std::string, int> map are both declarations too. Am I right?