]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Portability fix: Define template static members before functions
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 18 Feb 2011 12:32:27 +0000 (01:32 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 18 Feb 2011 12:32:27 +0000 (01:32 +1300)
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.

src/base/InstanceId.h

index 212c7f4f6624545aca6efec5d46e5af9d5e097a5..942aa80cb6fa8627c353a46829ecd2ac891ddf0d 100644 (file)
@@ -41,12 +41,12 @@ private:
 
 /// convenience macro to instantiate Class-specific stuff in .cc files
 #define InstanceIdDefinitions(Class, prefix) \
+    template<> const char *InstanceId<Class>::Prefix = prefix; \
+    template<> InstanceId<Class>::Value InstanceId<Class>::Last = 0; \
     template<> std::ostream & \
     InstanceId<Class>::print(std::ostream &os) const { \
         return os << Prefix << value; \
-    } \
-    template<> const char *InstanceId<Class>::Prefix = prefix; \
-    template<> InstanceId<Class>::Value InstanceId<Class>::Last = 0
+    }
 
 
 /// print the id