# C++: error: 'void D::f()' marked 'override', but does not override

**Code:** `marked override but does not override` · **Category:** C/C++ · **Seen on:** C/C++, GCC, Clang

A method has `override`, but no virtual function in the base class has exactly that signature.

## Meaning

A tiny signature difference — const, parameter type, reference, or name spelling — makes it a new function instead of an override. `override` turns that silent bug into an error.

## Common causes

- Missing or extra `const`
- Parameter types differ (int vs long)
- Base method not virtual
- Misspelled name

## Quick fix

1. Make the signature identical to the base
2. Declare the base function `virtual`
3. Remove `override` only if you intend a new function

## Detailed fix by platform

### GCC / Clang

1. Compare declarations side by side; use `-Woverloaded-virtual` to see hidden functions

## Code examples

### const mismatch

```cpp
struct Base { virtual void draw() const; };
struct Derived : Base { void draw() override; };   // error: marked 'override' but does not override (missing const)
```

## How to diagnose

1. **Signature** — Same params, const, noexcept?
2. **Virtual** — Base virtual?
3. **Name** — Spelling?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/cpp/override-does-not-override)
