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. 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 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.
State-Changed-From-To: open->analyzed State-Changed-Why: confirmed as a regression
Responsible-Changed-From-To: unassigned->nathan Responsible-Changed-Why: working on a fix
State-Changed-From-To: analyzed->closed State-Changed-Why: 2002-10-17 Nathan Sidwell <nathan@codesourcery.com> * class.c (add_method): Compare template parms too.
From: nathan@gcc.gnu.org To: gcc-gnats@gcc.gnu.org Cc: Subject: c++/7676 Date: 18 Oct 2002 08:17:57 -0000 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_2-branch Changes by: nathan@gcc.gnu.org 2002-10-18 01:17:57 Modified files: gcc/cp : ChangeLog class.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/overload: member2.C Log message: cp: PR c++/7676 * class.c (add_method): Compare template parms too. testsuite: * g++.dg/overload/member2.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.2685.2.114.2.25&r2=1.2685.2.114.2.26 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.436.2.10.2.5&r2=1.436.2.10.2.6 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.1672.2.166.2.32&r2=1.1672.2.166.2.33 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/overload/member2.C.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.2.1