[llvm-bugs] [Bug 36937] New: Diagnostic misleading on const override decl non-const defn

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 28 17:44:24 PDT 2018


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

            Bug ID: 36937
           Summary: Diagnostic misleading on const override decl non-const
                    defn
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: vmpstr at chromium.org
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Consider:

    class Base {
     public:
      virtual void f() const = 0;
    };

    class Derived : public Base {
     public:
      void f() const override;
    };

    void Derived::f() {}

Error message is:

    test.cpp:11:15: error: out-of-line definition of 'f' does not match any 
    declaration in 'Derived'
    void Derived::f() {}
              ^
    test.cpp:8:8: note: member declaration does not match because it is const 
    qualified
      void f() const override;
           ^         ~~~~~~~~
    1 error generated.

Note that the underlined suggestion points at "override" as the issue. I think
it be pointing at "const".

-- 
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/20180329/c640489e/attachment.html>


More information about the llvm-bugs mailing list