Bug 50504

Summary: gcc 2.96 unable to resolve an oveload taking the address of a template member
Product: [Retired] Red Hat Linux Reporter: Martin Sebor <sebor>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0   
Target Milestone: ---   
Target Release: ---   
Hardware: ia64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-10-01 23:15:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Martin Sebor 2001-07-31 18:47:24 UTC
This fails with 2.96 (as well as 2.95.2 and 3.0).

Martin

$ cat t.cpp ; gcc -v t.cpp
template <class T>
struct S
{
    S foo (T(T)) { return *this; }
    S foo (T(const T&)) { return *this; }
};

int main ()
{
    S<int> (S<int>::*pf1)(int (int)) = &S<int>::foo;
    S<int> (S<int>::*pf2)(int (const int&)) = &S<int>::foo;
}
Reading specs from /package/1/ia64/compilers/gcc-2.96-85/bin/../lib/gcc-lib/ia64
-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-85)
 /package/1/ia64/compilers/gcc-2.96-85/bin/../lib/gcc-lib/ia64-redhat-linux/2.96
/cpp0 -lang-c++ -D__GNUG__=2 -D__EXCEPTIONS -v -iprefix /package/1/ia64/compiler
s/gcc-2.96-85/bin/../lib/gcc-lib/ia64-redhat-linux/2.96/ -D__GNUC__=2 -D__GNUC_M
INOR__=96 -D__GNUC_PATCHLEVEL__=0 -D__ia64 -D__ia64__ -D__linux -D__linux__ -D_L
ONGLONG -Dlinux -Dunix -D__LP64__ -D__ELF__ -D__ia64 -D__ia64__ -D__linux -D__li
nux__ -D_LONGLONG -D__linux__ -D__unix__ -D__LP64__ -D__ELF__ -D__linux -D__unix
 -Asystem(linux) -Acpu(ia64) -Amachine(ia64) -D__NO_INLINE__ -D__LONG_MAX__=9223
372036854775807L t.cpp /tmp/ccvwt28r.ii
GNU CPP version 2.96 20000731 (Red Hat Linux 7.1 2.96-85) (cpplib) (IA-64)
#include "..." search starts here:
#include <...> search starts here:
 /package/1/ia64/compilers/gcc-2.96-85/include/g++-3
 /package/1/ia64/compilers/gcc-2.96-85/lib/gcc-lib/ia64-redhat-linux/2.96/includ
e
 /package/1/ia64/compilers/gcc-2.96-85/ia64-redhat-linux/include
 /usr/package/1/compilers/gcc-2.96-85-ia64/include/g++-3
 /usr/package/1/compilers/gcc-2.96-85-ia64/include
 /usr/package/1/compilers/gcc-2.96-85-ia64/lib/gcc-lib/ia64-redhat-linux/2.96/in
clude
 /usr/package/1/compilers/gcc-2.96-85-ia64/ia64-redhat-linux/include
 /usr/include
End of search list.
 /package/1/ia64/compilers/gcc-2.96-85/bin/../lib/gcc-lib/ia64-redhat-linux/2.96
/cc1plus /tmp/ccvwt28r.ii -mb-step -quiet -dumpbase t.cpp -version -o /tmp/ccs2N
tSL.s
GNU C++ version 2.96 20000731 (Red Hat Linux 7.1 2.96-85) (ia64-redhat-linux) co
mpiled by GNU C version 2.96 20000731 (Red Hat Linux 7.1 2.96-85).
t.cpp: In method `S<T> S<T>::foo (T)':
t.cpp:4: declaration of `T T'
t.cpp:1:  shadows template parm `class T'
t.cpp: In function `int main ()':
t.cpp:10: no matches converting function `foo' to type `struct S<int> 
(struct S<int>::*) (int (*) (int))'
t.cpp:4: candidates are: S<T> S<T>::foo (T) [with T = int]
t.cpp:5:                 S<T> S<T>::foo (T (*) (const T &)) [with T = 
int]

Comment 1 Richard Henderson 2004-10-01 23:15:14 UTC
Fixed during gcc 3.4 c++ parser rewrite.