Bug 7676 - Member template function overloading problem
Summary: Member template function overloading problem
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.2
: P1 critical
Target Milestone: ---
Assignee: Nathan Sidwell
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2002-08-21 03:46 UTC by nespub
Modified: 2003-07-25 17:33 UTC (History)
1 user (show)

See Also:
Host: i386-pc-linux-gnu
Target: i386-pc-linux-gnu
Build: i386-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nespub 2002-08-21 03:46:01 UTC
	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
Comment 1 nespub 2002-08-21 03:46:01 UTC
Fix:
	Use namespace instead of struct, but not always possible.
Comment 2 Nathan Sidwell 2002-09-13 15:13:48 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: confirmed as a regression
Comment 3 Nathan Sidwell 2002-10-16 13:02:15 UTC
Responsible-Changed-From-To: unassigned->nathan
Responsible-Changed-Why: working on a fix
Comment 4 Nathan Sidwell 2002-10-18 01:18:27 UTC
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.
Comment 5 Nathan Sidwell 2002-10-18 08:17:57 UTC
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