https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123919

            Bug ID: 123919
           Summary: gcc invalid accept a function marked 'override' but
                    does not override any member functions
           Product: gcc
           Version: 15.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mingdeng7254 at gmail dot com
  Target Milestone: ---

The following code:

```cpp
struct A {
    virtual void func(); 
};

template <typename T>
struct B {
    virtual void func() override; 
};
```

GCC incorrectly accepts `func()` in `B` as `override`, even though `B` does not
inherit from `A`.

A Godbolt link to the test case is here: https://godbolt.org/z/v5o3n5q8G

Reply via email to