[LLVMbugs] [Bug 22075] New: Poor diagnostics emitted when override appears before const in a method declaration

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Dec 31 10:29:30 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=22075

            Bug ID: 22075
           Summary: Poor diagnostics emitted when override appears before
                    const in a method declaration
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ehsan at mozilla.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

$ cat test.cpp
struct B { virtual void f(); virtual void f() const; };
struct D : B {
  virtual void f() override;
  virtual void f() override const;
};
$ ./bin/clang++ -std=c++11 -c test.cpp
test.cpp:4:16: error: class member cannot be redeclared
  virtual void f() override const;
               ^
test.cpp:3:16: note: previous declaration is here
  virtual void f() override;
               ^
test.cpp:4:28: error: expected ';' at end of declaration list
  virtual void f() override const;
                           ^
                           ;
2 errors generated.

We can probably emit a fixit hint to suggest "const override".  Also, the first
error message seems to be misguided because we fail to consume the const token.

-- 
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/20141231/c942a0a2/attachment.html>


More information about the llvm-bugs mailing list