Bug#265057: gnugk: FTBFS with gcc-3.4: `InstanceOf' is neither function nor member function; cannot be declared friend

Andreas Jochens Andreas Jochens <aj@andaco.de>, 265057@bugs.debian.org
Wed, 11 Aug 2004 16:55:40 +0200


Package: gnugk
Severity: normal
Tags: patch

When building 'gnugk' with gcc-3.4 I get the following error:

                 from MulticastGRQ.cxx:38:
singleton.h:88: error: `InstanceOf' is neither function nor member function; cannot be declared friend
singleton.h:88: error: expected `;' before '<' token
singleton.h: In function `T* InstanceOf() [with T = Toolkit]':
Toolkit.h:308:   instantiated from here
singleton.h:144: error: `SingletonBase*Singleton<Toolkit>::m_Instance' is private
singleton.h:134: error: within this context
Toolkit.h:308:   instantiated from here
singleton.h:145: error: `PMutex Singleton<Toolkit>::m_CreationLock' is private
singleton.h:135: error: within this context
Toolkit.h:308:   instantiated from here
singleton.h:144: error: `SingletonBase*Singleton<Toolkit>::m_Instance' is private
singleton.h:137: error: within this context
singleton.h:144: error: `SingletonBase*Singleton<Toolkit>::m_Instance' is private
singleton.h:138: error: within this context
singleton.h:144: error: `SingletonBase*Singleton<Toolkit>::m_Instance' is private
singleton.h:140: error: within this context
make[1]: *** [obj_linux_x86_64_r/MulticastGRQ.o] Error 1
make[1]: Leaving directory `/gnugk-2.0.8'
make: *** [build-stamp] Error 2

With the attached patch 'gnugk' can be compiled using gcc-3.4.

Regards
Andreas Jochens

Binary files ../tmp-orig/gnugk-2.0.8/obj_linux_x86_64_r/addpasswd and ./obj_linux_x86_64_r/addpasswd differ
Binary files ../tmp-orig/gnugk-2.0.8/obj_linux_x86_64_r/addpasswd.o and ./obj_linux_x86_64_r/addpasswd.o differ
diff -urN ../tmp-orig/gnugk-2.0.8/singleton.h ./singleton.h
--- ../tmp-orig/gnugk-2.0.8/singleton.h	2004-05-12 19:46:41.000000000 +0200
+++ ./singleton.h	2004-08-11 16:30:01.632778579 +0200
@@ -81,12 +81,7 @@
 	Singleton();
 	~Singleton();
 
-#ifdef WIN32
   public:
-#else
-  private:
-	friend T *InstanceOf<T>();
-#endif
 	static SingletonBase *m_Instance;
 	static PMutex m_CreationLock;
 };