[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Member template function overloading problem



>Submitter-Id:	net
>Originator:	
>Organization:	EPITA-LRDE
>Confidential:	no
>Synopsis:	Member template function overloading problem
>Severity:	critical
>Priority:	medium
>Category:	c++
>Class:		rejects-legal
>Release:	3.2 20020809 (Debian prerelease) (Debian testing/unstable)
>Environment:
System: Linux ouagadougou 2.4.17 #1 Thu May 30 08:30:13 CEST 2002 i586 unknown unknown GNU/Linux
Architecture: i586

	
host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
configured with: /mnt/data/gcc-3.1/gcc-3.2-3.2ds0/src/configure -v --enable-languages=c,c++,java,f77,proto,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-java-gc=boehm --enable-objc-gc i386-linux
>Description:
	Member template functions overloading fails when overloading is
	based on the template parameter list. It fails with g++-3.1 older than
	pre-2 version, and g++-3.2. It works outside any class.

	Referring to sections (14.5.5.1-4) and (14.5.2-8) it seems to be
	a bug. g++ < 3.1 accepts it, como and icc too.
>How-To-Repeat:
	struct foo
	{
  	  template<class T>
  	  void bar();
  
  	  template<int I>
  	  void bar();
 	};

$ g++-3.2 template_overloading.cc
template_overloading.cc:7: `template<int I> void foo::bar()' and `
   template<class T> void foo::bar()' cannot be overloaded

>Fix:
	Use namespace instead of struct, but not always possible.



Reply to: