This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

a compiation issue with gcc


The following code  does not compile with gcc (ggc -c simple.cpp) and
gives the following errors ( where as the code compiles in windows
VC++ )-
Could someone tell me the reason for this, and if there is an
available workaround.
Thanks,

#include "iostream.h"
#include "stdio.h"
template <class T,void (*DestroyCallback)( T )> class B
{
private:	
	int a;
};		
template <class T> class A
{
private:
	static void ASFreeWrapper( T Ptr )
	{
		free( Ptr );	
	}
public:
	typedef B<T,&ASFreeWrapper> Type;

};
int main()
{
	A<int *> a;
	return 0;
}

/* Here is the error reported by gcc -
simple.cpp:9: warning: all member functions in class `A<T>' are private
simple.cpp: In instantiation of `A<int*>':
simple.cpp:21:   instantiated from here
simple.cpp:16: invalid use of undefined type `class A<int*>'
simple.cpp:9: declaration of `class A<int*>'
*/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]