[Bug c++/56359] New: [4.8 regression] Bogus "error: no matching function for call to ..."

ppluzhnikov at google dot com gcc-bugzilla@gcc.gnu.org
Sun Feb 17 01:19:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56359

             Bug #: 56359
           Summary: [4.8 regression] Bogus "error: no matching function
                    for call to ..."
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ppluzhnikov@google.com


Google ref b/8213841

Test case reduced from nodejs/src/node_io_watcher.cc



typedef int (*InvocationCallback) (const int &);

template < typename target_t >
void SetPrototypeMethod (target_t, const char *, InvocationCallback);

class A
{
    void Initialize ();
protected:
    static int Stop (const int &);
    void Stop ();  // comment out to make the bug disappear.
};

void
A::Initialize ()
{
    SetPrototypeMethod (0, "stop", A::Stop);
}


Compiles fine with gcc-4.7, fails with SVN trunk @196104:


g++ -c  t.ii
t.ii: In member function ‘void A::Initialize()’:
t.ii:17:43: error: no matching function for call to ‘SetPrototypeMethod(int,
const char [5], <unresolved overloaded function type>)’
     SetPrototypeMethod (0, "stop", A::Stop);
                                           ^
t.ii:17:43: note: candidate is:
t.ii:4:6: note: template<class target_t> void SetPrototypeMethod(target_t,
const char*, InvocationCallback)
 void SetPrototypeMethod (target_t, const char *, InvocationCallback);
      ^
t.ii:4:6: note:   template argument deduction/substitution failed:
t.ii: In substitution of ‘template<class target_t> void
SetPrototypeMethod(target_t, const char*, InvocationCallback) [with target_t =
int]’:
t.ii:17:43:   required from here
t.ii:10:16: error: ‘static int A::Stop(const int&)’ is protected
     static int Stop (const int &);
                ^
t.ii:17:43: error: within this context
     SetPrototypeMethod (0, "stop", A::Stop);
                                           ^



More information about the Gcc-bugs mailing list