https://bugs.llvm.org/show_bug.cgi?id=32647

            Bug ID: 32647
           Summary: marked override but does not override should note
                    similar functions
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: nlewy...@google.com
                CC: dgre...@apple.com, llvm-bugs@lists.llvm.org

We should look for similar functions in the base and list them when override is
used and it does not override. Since that is an error, when there's only one
best option we should also consider fixit hint + recovery with the fix.

Testcase:

struct Base {
  virtual ~Base();
  virtual void MixedConst() const {}
  virtual void SlightTypo() {}
};

struct Derived : public Base {
  virtual ~Derived();
  virtual void MixedConst() override {}
  virtual void SlightTypoe() override {}
};

$ clang++ -std=c++11 b10446365.cc 
b10446365.cc:9:16: error: 'MixedConst' marked 'override' but does not override
      any member functions
  virtual void MixedConst() override {}
               ^
b10446365.cc:10:16: error: 'SlightTypoe' marked 'override' but does not
override
      any member functions
  virtual void SlightTypoe() override {}
               ^
2 errors generated.

The first one should note the difference in cv-qualifier, and also apply to
ref-qualifiers. The second one is an example where typo correction could pick
the right name out of the base.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to