<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/63897>63897</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            -Woverloaded-shift-op-parentheses bugs
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          jeremy-rifkin
      </td>
    </tr>
</table>

<pre>
    **Background:** I am the author of a library called libassert. The library does some tricks to decompose a user-provided expression into a left and right hand side with something along the lines of `expression_decomposer{} << expr`.

**Bug:**
This triggers `-Woverloaded-shift-op-parentheses`
```cpp
class test_class {
 void something_else() {
        std::string s = "test\n";
 ASSERT(s == "test");
    }
};
```
This does not:
```cpp
void something_else() {
    std::string s = "test\n";
    ASSERT(s == "test");
}
```


Additionally, `_Pragma("GCC diagnostic ignored \"-Woverloaded-shift-op-parentheses\"")` doesn't work to suppress the buggy error message. https://godbolt.org/z/ef9sn4fYb

The relevant part of the code in question looks something like

```cpp
 #if LIBASSERT_IS_GCC
  #define LIBASSERT_EXPRESSION_DECOMP_WARNING_PRAGMA \
     _Pragma("GCC diagnostic ignored \"-Wparentheses\"") \
 _Pragma("GCC diagnostic ignored \"-Wuseless-cast\"") // #49
 #else
  #define LIBASSERT_EXPRESSION_DECOMP_WARNING_PRAGMA \
 _Pragma("GCC diagnostic ignored \"-Wparentheses\"") \
 _Pragma("GCC diagnostic ignored \"-Woverloaded-shift-op-parentheses\"")
 #endif
...
#define ASSERT_INVOKE(expr, doreturn, check_expression, name, type, failaction, ...) \
        LIBASSERT_IGNORE_UNUSED_VALUE \
        LIBASSERT_STMTEXPR( \
          LIBASSERT_WARNING_PRAGMA_PUSH \
 LIBASSERT_EXPRESSION_DECOMP_WARNING_PRAGMA \
          auto libassert_decomposer = \
 libassert::detail::expression_decomposer(libassert::detail::expression_decomposer{} << expr); \
          LIBASSERT_WARNING_PRAGMA_POP \
 ...
```

https://github.com/jeremy-rifkin/libassert/blob/55d05fb987bea8d6080718dc6262b9cb8a8ad17b/include/assert.hpp

I apologize as I have not yet been able to create a minimal reproducible example yet
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVl9v4jgQ_zTmZQQKDpDkgQfKnx663bYq7e7dE3LiSeLFsXO2013205-cUEiv-6-nky5CibF_M57fzHjGzFpRKMQ5mV6R6WrAGldqM_-EBqvj0Ij8INQg1fw4J3RB6OKKZYfC6EZxEi66KdgCq8CVCJ0w6BwYSJEaZo6QMSmR-7_MWjRuBA8lnle5RgtWVwjOiOxgwWngmOmq1haBQWPRDGujnwRHDvilNmit0AqEctrvgrkDpjgYUZQOSj-0giN8Fq5sFbtSqAKY1KpobZRCofUmkllw0bc_b2pIdEWiFZBwScJluyWZBSMSrEiwOL07TzTF2QXd_EMprOdRFGis1z_8qJ_QSM048qEtRe6Guh7WzKByJVq0ZBacVM6C7pfVdTeTSWYtOLRu3w29Xe0KPGnBL9z2KC0SGhOa9DCnx7o2TuHCOuP9YIGEKyCUesVkulSEUhI-Cy12u_X9A6FxC-sjKSU0uQABgESrk-nR6rxwptFzSBtipZ234ztcf5HQ28gA_DKfC5eX9vffC86FE1oxKY-ELn1493eGFRVrTaXXyyVwwQqlrRMZiEJpgxzIdEko_XkitLCTWbOgdZoiNHLwWZuDPxW2qdtkbZM4bYriCGiMNlChtazAEZTO1bZNyQ2hm0LzVEs30qYgdPOV0A3miVWT_M-0T8sfRoMSn5hyUDPj_NHwW2SaIwgFfzVoPW-QWh9s70hJccAXbnoVViA0FDm82151gdhvd_vr5fI5PoSGHHOhsIdY_3F3v97ttrc3-9V6efv-bv9xcX-zvbne390vrt8vWn9eMvwtEfiOt3sa36KtsSjR2mHG2tTrqWu978lNkosb2pT-b3j_f5zfksMX5oqLvPs7Gj2X0bMHnhPj5sPt72tC47bc0iVwbdA1RvlxVmJ22F9qtZ9TrEL_dce6_eZMSJa506rf6AXL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