That can be a definition or a declaration, depending on what type T is:
Code:
void T();
T t;// declaration of function "t"
struct X {
T t;// declaration of function "t".
};
typedefint T;
T t;// definition of object "t".
In C++, when using templates, there is another edge case.
Code:
<typename T>
struct X {
staticint member;// declaration
};
template<typename T>
int X<T>::member;// definition
template<>
int X<bool>::member;// declaration!
The last declaration was not a definition. It's the declaration of an explicit specialization of the static member of X<bool>. It tells the compiler: "If it comes to instantiating , then don't instantiate the definition of the member from the primary template, but use the definition found elsewhere". To make it a definition, you have to supply an initializer
Code:
<>
int X<bool>::member =1;// definition, belongs into a .cpp file.