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: unassignedclangb...@nondot.org
          Reporter: jykni...@google.com
                CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
                    richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to