[llvm-bugs] [Bug 40205] New: Misleading carat in fixit hint for constexpr-not-const

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 2 10:43:04 PST 2019


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

            Bug ID: 40205
           Summary: Misleading carat in fixit hint for constexpr-not-const
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jyknight at google.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

Given this:

clang -std=c++11 -fsyntax-only -c -Wconstexpr-not-const test.cc

test.cc:
class Foo {
  constexpr int operator()() { return 0; }
};


You get:

test.cc:2:17: warning: 'constexpr' non-static member function will not be
implicitly 'const' in C++14; add 'const' to avoid a change in behavior
[-Wconstexpr-not-const]
  constexpr int operator()() { return 0; }
                ^
                             const

The carat points before/to the function name -- which makes it seem like that's
where it wants you to add "const". However, you really need to add it at the
end -- where the text "const" is printed, rather than where the carat points
to. 

That's confusing.

-- 
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/20190102/be287a87/attachment.html>


More information about the llvm-bugs mailing list