From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1779 invoked by alias); 10 Nov 2002 20:46:02 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 1740 invoked by uid 71); 10 Nov 2002 20:46:02 -0000 Date: Sun, 10 Nov 2002 12:46:00 -0000 Message-ID: <20021110204602.1739.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Wolfgang Bangerth Subject: Re: c++/950: Template lookup problem Reply-To: Wolfgang Bangerth X-SW-Source: 2002-11/txt/msg00486.txt.bz2 List-Id: The following reply was made to PR c++/950; it has been noted by GNATS. From: Wolfgang Bangerth To: gcc-bugs@gcc.gnu.org, Cc: Subject: Re: c++/950: Template lookup problem Date: Sun, 10 Nov 2002 14:46:04 -0600 (CST) A reduced testcase for this one is -------------------------------------------- struct B { void a (int n); }; struct D: public B {}; template struct X { template static void foo (const Y&, void (T::*)(Y)); }; int main () { int n = 3; X::foo(n, &D::a); } -------------------------------------- The error I get is this one: x.cc: In function `int main()': x.cc:11: error: no matching function for call to `X::foo(int&, void (B::*)(int))' Thus, the compiler cannot find a match for X::foo, since &D::a is immediately converted to &B::a, i.e. to a pointer to member function of the _base_ class, although we have taken a p-t-m-f of the derived class. I don't know what the standard says on this one, but at least the failure mode is clear now. The problem can be worked around using a temporary variable of type void (D::*)(int) or an explicit cast. Regards Wolfgang ------------------------------------------------------------------------- Wolfgang Bangerth email: bangerth@ticam.utexas.edu www: http://www.ticam.utexas.edu/~bangerth