samedi 28 juin 2014

Template variable leads to warning


Vote count:

0




This code gives me the following warning in Clang and I am not sure why or if this is a problem. warning: variable 'M_PI<int>' has internal linkage but is not defined [-Wundefined-internal]



template <typename T>
constexpr T M_PI = T(3.1415926535897932);

template <typename T>
constexpr T CalcCircumference(T d)
{
return d * M_PI<T>;
}

int main()
{
return CalcCircumference(42);
}


asked 38 secs ago






Aucun commentaire:

Enregistrer un commentaire