[llvm-bugs] [Bug 52103] New: Wunreachable-code warns that [[likely]] and [[unlikely]] are unreachable

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 7 07:34:02 PDT 2021


            Bug ID: 52103
           Summary: Wunreachable-code warns that [[likely]] and
                    [[unlikely]] are unreachable
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

$ cat foo.cc
int main(int argc, char* argv[]) {
  if (argc > 100) [[unlikely]]
    return 1;

  return 0;

$ out/gn/bin/clang -Wunreachable-code -c foo.cc -std=c++20 
foo.cc:2:19: warning: code will never be executed [-Wunreachable-code]
  if (argc > 100) [[unlikely]]

That's pretty silly.

(There's also bug 19020; not quite sure if this is a dupe of that or not.)

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/20211007/c270b330/attachment.html>

More information about the llvm-bugs mailing list