Неоднозначное определение operator () с множественным наследованием

Я компилирую этот код с помощью GCC (4.2.1 Apple build 5664)

#include <cstddef>

using std::size_t;

template <char I> struct index { };

struct a
{
    void operator()(size_t const &) { }
};

struct b
{
    template <char I>
    void operator()(index<I> const &) { }
};

struct c: public a, public b { };

int main (int argc, char const *argv[])
{
    c vc;
    vc(1);

    return 0;
}

и выдаю мне следующую ошибку:

main.cpp: In function ‘int main(int, const char**)’:
main.cpp:22: error: request for member ‘operator()’ is ambiguous
main.cpp:14: error: candidates are: template<char I> void b::operator()(const index<I>&)
main.cpp:9:  error:                 void a::operator()(const size_t&)

Я не понимаю, почему этот код неоднозначен; эти два метода имеют разные сигнатуры.

8
задан Lightness Races with Monica 27 July 2011 в 14:36
поделиться