[llvm-bugs] [Bug 32647] New: marked override but does not override should note similar functions
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Apr 12 15:53:11 PDT 2017
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: unassignedclangbugs at nondot.org
Reporter: nlewycky at google.com
CC: dgregor at apple.com, llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170412/f8392aa1/attachment.html>
More information about the llvm-bugs
mailing list