From 9f31addfa5d7dc97a886c432c3a435f0c8356563 Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Fri, 16 Nov 2012 16:49:35 +0100 Subject: [PATCH] Fix for old gcc which got broken by fix for VS --- simgear/compiler.h | 3 +++ simgear/nasal/cppbind/Ghost.hxx | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/simgear/compiler.h b/simgear/compiler.h index 372f571d..e94c7ee4 100644 --- a/simgear/compiler.h +++ b/simgear/compiler.h @@ -46,6 +46,9 @@ # warning GCC compilers prior to 3.4 are suspect # endif +# define GCC_VERSION (__GNUC__ * 10000 \ + + __GNUC_MINOR__ * 100 \ + + __GNUC_PATCHLEVEL__) # define SG_COMPILER_STR "GNU C++ version " SG_STRINGIZE(__GNUC__) "." SG_STRINGIZE(__GNUC_MINOR__) #endif // __GNUC__ diff --git a/simgear/nasal/cppbind/Ghost.hxx b/simgear/nasal/cppbind/Ghost.hxx index 746be96c..288c5113 100644 --- a/simgear/nasal/cppbind/Ghost.hxx +++ b/simgear/nasal/cppbind/Ghost.hxx @@ -279,7 +279,20 @@ namespace nasal bases() { BaseGhost* base = BaseGhost::getSingletonPtr(); - base->addDerived( &Ghost::getTypeFor ); + base->addDerived + ( + // Both ways of retrieving the address of a static member function + // should be legal but not all compilers know this. + // g++-4.4.7+ has been tested to work with both versions +#if defined(GCC_VERSION) && GCC_VERSION < 40407 + // The old version of g++ used on Jenkins (16.11.2012) only compiles + // this version. + &getTypeFor +#else + // VS (2008, 2010, ... ?) only allow this version. + &Ghost::getTypeFor +#endif + ); // Replace any getter that is not available in the current class. // TODO check if this is the correct behavior of function overriding -- 2.39.5