This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/9437: template function parameter `T*' shouldn't match pointers to members
- From: bangerth at dealii dot org
- To: gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, martin at xemacs dot org, nobody at gcc dot gnu dot org
- Date: 24 Jan 2003 20:12:59 -0000
- Subject: Re: c++/9437: template function parameter `T*' shouldn't match pointers to members
- Reply-to: bangerth at dealii dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, martin at xemacs dot org, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
Synopsis: template function parameter `T*' shouldn't match pointers to members
State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Fri Jan 24 20:12:59 2003
State-Changed-Why:
Something's indeed wrong here. To see what the template
parameter matches, execute the following variation:
-------------------------
extern "C" void printf (const char *, ...);
struct S {
template <typename T>
operator T* () const {
printf ("%s\n", __PRETTY_FUNCTION__);
return static_cast<T*> (0);
}
} null;
struct A { int i; };
static void f (int A::* pmi) { }
int main () { f (null); }
-----------------------------
It displays
g/a> /home/bangerth/bin/gcc-3.4-pre/bin/c++ x.cc
g/a> ./a.out
S::operator T*() const [with T = int A::*]
But then the return type would be _pointer_ to member
pointer, not member pointer.
Confirmed with 2.95, 3.2.2, 3.3, 3.4
W.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9437