[llvm-bugs] [Bug 30636] an impossible case for -Wimplicit-fallthrough and [[clang::fallthrough]]

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 10 14:18:48 PST 2016


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

Ahmed Asadi <ahmedasadics at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |ahmedasadics at gmail.com
         Resolution|---                         |INVALID

--- Comment #1 from Ahmed Asadi <ahmedasadics at gmail.com> ---
fun<false> gets instantiated to the following function:

int fun(int i)
{
  switch (i)
    {
    case 1:
      if (false)
        return 3;
    case 2:
      return 4;
    default:
      return 5;
    }
}

case 1 falls through to case 2, hence the warning.

When you insert [[clang::fallthrough]], it isn't reachable in fun<true> because
it will always hit 'return 3'.

Clang produces valid warnings in both cases. I'm marking the bug as invalid.

-- 
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/20161110/b4cf11eb/attachment-0001.html>


More information about the llvm-bugs mailing list