From: Amos Jeffries Date: Fri, 18 Feb 2011 12:32:27 +0000 (+1300) Subject: Portability fix: Define template static members before functions X-Git-Tag: take03^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd3f0ed7794ffaab78abb3c85c6bb8522275ace5;p=thirdparty%2Fsquid.git Portability fix: Define template static members before functions ICC complains about 'explicit specialization of member must precede its first use' if the templand and members are not pre-defined. Strangely other strict compilers do not mention any problem. --- diff --git a/src/base/InstanceId.h b/src/base/InstanceId.h index 212c7f4f66..942aa80cb6 100644 --- a/src/base/InstanceId.h +++ b/src/base/InstanceId.h @@ -41,12 +41,12 @@ private: /// convenience macro to instantiate Class-specific stuff in .cc files #define InstanceIdDefinitions(Class, prefix) \ + template<> const char *InstanceId::Prefix = prefix; \ + template<> InstanceId::Value InstanceId::Last = 0; \ template<> std::ostream & \ InstanceId::print(std::ostream &os) const { \ return os << Prefix << value; \ - } \ - template<> const char *InstanceId::Prefix = prefix; \ - template<> InstanceId::Value InstanceId::Last = 0 + } /// print the id