[llvm-bugs] [Bug 31373] New: -Wunused-variable does not detect unused condition variable

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Dec 14 11:47:13 PST 2016


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

            Bug ID: 31373
           Summary: -Wunused-variable does not detect unused condition
                    variable
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

-Wunused-variable does not warn on this case:

bool f();
void g() {
  if (bool b = f()) {
    // ...
  }
}

GCC's version of the warning does. Presumably we're marking the variable as
'used' in the condition handling code; while that's technically correct, it
doesn't lead to the right outcome here.

-- 
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/20161214/741e66cb/attachment-0001.html>


More information about the llvm-bugs mailing list