[LLVMbugs] [Bug 18971] New: Missing -Wparentheses warning

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Feb 26 00:00:59 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=18971

            Bug ID: 18971
           Summary: Missing -Wparentheses warning
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dblaikie at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu,
                    rtrieu at google.com, samsonov at google.com
    Classification: Unclassified

$ cat tmp/warning/a.cc
#include <cassert>
bool x;
int val;
void foo() {
  assert(x && val == 4 || (!x && val == 5));
}

$ gcc-4.8.2-inst/bin/g++ -c tmp/warning/a.cc -Wall -o a.o
In file included from /gcc-4.8.2-inst/include/c++/4.8.2/cassert:43:0,
                 from tmp/warning/a.cc:1:
tmp/warning/a.cc: In function ‘void foo()’:
tmp/warning/a.cc:5:12: warning: suggest parentheses around ‘&&’ within ‘||’
[-Wparentheses]
   assert(x && val == 4 || (!x && val == 5));
            ^
$ ./bin/clang++ -c tmp/warning/a.cc -Wall -o a.o

-- 
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/20140226/23146825/attachment.html>


More information about the llvm-bugs mailing list