(svn r9732) [NoAI] -Fix: GCC 2.95 doesn't like SQConvert::Bla inside a template. Use 'using namespace' to avoid. This re-enables MorphOS target for NoAI branch. noai
authortruelight
Sat, 28 Apr 2007 13:38:48 +0000
branchnoai
changeset 9602 f9f8a5a15f60
parent 9601 b499fdd106d5
child 9603 49323bf80ebd
(svn r9732) [NoAI] -Fix: GCC 2.95 doesn't like SQConvert::Bla inside a template. Use 'using namespace' to avoid. This re-enables MorphOS target for NoAI branch.
src/squirrel_class.hpp
--- a/src/squirrel_class.hpp	Sun Apr 22 19:06:48 2007 +0000
+++ b/src/squirrel_class.hpp	Sat Apr 28 13:38:48 2007 +0000
@@ -5,6 +5,14 @@
 #ifndef SQUIRREL_CLASS_HPP
 #define SQUIRREL_CLASS_HPP
 
+#if (__GNUC__ == 2)
+/* GCC 2.95 doesn't like to have SQConvert::DefSQStaticCallback inside a
+ *  template (it gives an internal error 373). Above that, it doesn't listen
+ *  to 'using namespace' inside a function of a template. So for GCC 2.95 we
+ *  do it in the global space to avoid compiler errors. */
+using namespace SQConvert;
+#endif /* __GNUC__ == 2 */
+
 /**
  * The template to define classes in Squirrel. It takes care of the creation
  *  and calling of such classes, to make the AI Layer cleaner while having a
@@ -48,7 +56,8 @@
 	template <typename Func>
 	void DefSQMethod(Squirrel *engine, Func function_proc, const char *function_name)
 	{
-		engine->AddMethod(function_name, SQConvert::DefSQNonStaticCallback<CL, Func>, 0, NULL, &function_proc, sizeof(function_proc));
+		using namespace SQConvert;
+		engine->AddMethod(function_name, DefSQNonStaticCallback<CL, Func>, 0, NULL, &function_proc, sizeof(function_proc));
 	}
 
 	/**
@@ -60,7 +69,8 @@
 	template <typename Func>
 	void DefSQMethod(Squirrel *engine, Func function_proc, const char *function_name, int nparam, const char *params)
 	{
-		engine->AddMethod(function_name, SQConvert::DefSQNonStaticCallback<CL, Func>, nparam, params, &function_proc, sizeof(function_proc));
+		using namespace SQConvert;
+		engine->AddMethod(function_name, DefSQNonStaticCallback<CL, Func>, nparam, params, &function_proc, sizeof(function_proc));
 	}
 
 	/**
@@ -69,7 +79,8 @@
 	template <typename Func>
 	void DefSQStaticMethod(Squirrel *engine, Func function_proc, const char *function_name)
 	{
-		engine->AddMethod(function_name, SQConvert::DefSQStaticCallback<CL, Func>, 0, NULL, &function_proc, sizeof(function_proc));
+		using namespace SQConvert;
+		engine->AddMethod(function_name, DefSQStaticCallback<CL, Func>, 0, NULL, &function_proc, sizeof(function_proc));
 	}
 
 	/**
@@ -81,7 +92,8 @@
 	template <typename Func>
 	void DefSQStaticMethod(Squirrel *engine, Func function_proc, const char *function_name, int nparam, const char *params)
 	{
-		engine->AddMethod(function_name, SQConvert::DefSQStaticCallback<CL, Func>, nparam, params, &function_proc, sizeof(function_proc));
+		using namespace SQConvert;
+		engine->AddMethod(function_name, DefSQStaticCallback<CL, Func>, nparam, params, &function_proc, sizeof(function_proc));
 	}
 
 	template <typename Var>