[LLVMbugs] [Bug 21372] New: -Woverloaded-shift-op-parentheses warning text reverses precedence

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Oct 24 07:12:08 PDT 2014


            Bug ID: 21372
           Summary: -Woverloaded-shift-op-parentheses warning text
                    reverses precedence
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mitza at ociweb.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Version is 3.5.0 but Bugzilla doesn't let me select it.

-Woverloaded-shift-op-parentheses tells me:

warning: overloaded operator >> has lower precedence than comparison operator

No, it has higher precedence.  See
http://en.cppreference.com/w/cpp/language/operator_precedence and Matt's
comments from

This warning is biased to std::iostreams usage

stream << something == other

really does deserve a warning.  The particular code I'm looking at is not
std::istream and its operator>> returns a result code, not a stream&.

if (custom_stream >> variable == 0)

This doesn't need extra parens and doesn't deserve a warning.  In general, the
iostreams misuse can be constrained to operator<< since operator>> takes an
rvalue (or manipulator) so probably won't be a comparison expression.

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/20141024/122b017c/attachment.html>

More information about the llvm-bugs mailing list