c++/9032: Can't find template match

bangerth@dealii.org bangerth@dealii.org
Fri Dec 20 14:24:00 GMT 2002


Synopsis: Can't find template match

State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Fri Dec 20 14:24:08 2002
State-Changed-Why:
    It should compile. Here's a slightly smaller testcase:
    -------------------
    struct A {
        void g();
    };
    
    struct B : A {};
    
    template<class T>
    void  f(T, void (T::*m)());
    
    int main() {
      f(B(), &B::g);
    }
    ------------------------
    
    tmp/g> /home/bangerth/bin/gcc-3.4-CVS/bin/c++ -c troep.cc
    troep.cc: In function `int main()':
    troep.cc:11: error: no matching function for call to `f(B, void (A::*)())'
    
    The problem is that &B::g decays too quickly to &A::g.
    
    I'm pretty sure this is a duplicate of some other report
    which I've seen lately (I though I had even filed it myself,
    but couldn't find it among mine...).
    
    W.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9032



More information about the Gcc-prs mailing list