Improve error for "override" + non-virtual func.
authorEli Friedman <eli.friedman@gmail.com>
Thu, 5 Sep 2013 23:51:03 +0000 (23:51 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Thu, 5 Sep 2013 23:51:03 +0000 (23:51 +0000)
commitaf65120bd3825ed7548108618cc709ba22102439
tree373d9247be356344a8d77f549fc02db94d109d2e
parentc27d0d5ef26adc71074b699da9a12e78970fbaee
Improve error for "override" + non-virtual func.

Consider something like the following:

struct X {
  virtual void foo(float x);
};
struct Y : X {
  void foo(double x) override;
};

The error is almost certainly that Y::foo() has the wrong signature,
rather than incorrect usage of the override keyword.  This patch
adds an appropriate diagnostic for that case.

Fixes <rdar://problem/14785106>.

llvm-svn: 190109
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaDeclCXX.cpp
clang/test/CXX/class.derived/class.virtual/p3-0x.cpp