Having trouble overriding a virtual method declared with template parameter pack expansion

Viewed 1733

I'm having trouble overriding a virtual method of the base class specified using template parameter pack expansion - while the overriding method will exhibit the actual relevant types. Here's an MCVE:

#include <iostream>
template <typename... Ts>
class A { virtual void foo(Ts&&...); };

class B : public A<int, unsigned> {
    void foo(int x, unsigned y) override { std::cout << "here"; }
};

int main() {
    B b;
}

Compiling this (with standard set to either C++11 or C++14), I get:

a.cpp:9:7: error: ‘void B::foo(int, unsigned int)’ marked override, but does not override
  void foo(int x, unsigned y) override {
       ^
1 Answers
Related