Fix for old gcc which got broken by fix for VS

This commit is contained in:
Thomas Geymayer
2012-11-16 16:49:35 +01:00
parent d56ea7e6c4
commit 9f31addfa5
2 changed files with 17 additions and 1 deletions

View File

@@ -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__

View File

@@ -279,7 +279,20 @@ namespace nasal
bases()
{
BaseGhost* base = BaseGhost::getSingletonPtr();
base->addDerived( &Ghost::getTypeFor<BaseGhost> );
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<BaseGhost>
#else
// VS (2008, 2010, ... ?) only allow this version.
&Ghost::getTypeFor<BaseGhost>
#endif
);
// Replace any getter that is not available in the current class.
// TODO check if this is the correct behavior of function overriding