[Gridflow-dev] gridflow-0.9.3 fails to compile with g++ 4.3.1

Claude Heiland-Allen claudiusmaximus at goto10.org
Tue Jun 17 08:51:25 EDT 2008


Claude Heiland-Allen wrote:
> Hi,
> 
> with:
> 
> g++ --version
> 
> g++ (Debian 4.3.1-2) 4.3.1
> Copyright (C) 2008 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> 
> i get this error:
> 
> base/number.c.fcs: At global scope:
> base/number.c.fcs:185: error: explicit template specialization cannot 
> have a storage class

Same with fresh SVN...

Some more info:

http://gcc.gnu.org/gcc-4.3/porting_to.html
--------8<--------
Explicit template specialization cannot have a storage class

Specializations of templates cannot explicitly specify a storage class, 
and have the same storage as the primary template. This is a change from 
previous behavior, based on the feedback and commentary as part of the 
ISO C++ Core Defect Report 605.

template<typename T>
   static void foo();

template<>
   static void foo<void>();

Gives:

error: explicit template specialization cannot have a storage class

This also happens with the extern specifier. Fixing this is easy: just 
remove any storage specifier on the specialization. Like so:

template<typename T>
   static void foo();

template<>
   void foo<void>();
--------8<--------

and an example fix is here:

http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=21;filename=mecab-0.96-1.1-nmu.diff.txt;att=1;bug=461727
--------8<--------
+#ifndef GCC_VERSION
+#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
+#endif
+#if GCC_VERSION >= 403
+# define STATIC
+#else
+# define STATIC static
+#endif

- static std::string lexical_cast<std::string, std::string>(std::string 
arg) {
+ STATIC std::string lexical_cast<std::string, std::string>(std::string 
arg) {
      return arg;
    }
--------8<--------


Claude
-- 
http://claudiusmaximus.goto10.org



More information about the Gridflow-dev mailing list