This week I learned that bugs that manifest during the linking phase are still hard to track down. Can you spot the bug?

struct Base {
  virtual ~Base() = default;
  virtual void Foo() = 0;
  virtual void Bar() = 0;
  virtual void Baz();
};

struct Derived final : public Base {
  void Foo() final override {}
  void Bar() final override {}
  void Baz() final override {}
};

struct Client {
  Base *ptr = nullptr;
};

int main() {
  Derived d;
  Client client{&d};
  (void)client;
  return 0;
}

Base::Baz isn’t pure virtual so ld is looking for–and failing to find–an implementation for Baz in Base. Marking Base::Baz pure virtual solves the problem.