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

    <tr>
        <th>Summary</th>
        <td>
            [clang][c23] macro + non-void cast incorrectly suppresses "nodiscard" warning
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          poconn
      </td>
    </tr>
</table>

<pre>
    clang-18 compiles the following code warning-free at `-Weverything`, but should warn because the result of `f()` is essentially discarded (aside from the cast, but it would be to void if the result was supposed to be ignorable):
```c
[[nodiscard]] int f();

void g() {
#define M (unsigned int)f()
 M;
}
```
https://godbolt.org/z/9sdcY3eof

It does correctly warn when compiling as C++ (even with the C-style cast).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxcU8GO4yAM_RpysVpRk7TJIYfpVJH2MOfVHgk4CSsKFZBW3a9fQVt1NFKUCGE_v-f3ImM0syPqWXNkzamSa1p86C9eeeeq0et7r6x082bXgvLni7EUIS0Ek7fW34ybQXlNcJPBGTdvpkAEMgHb881vulK4p8W4me05w08Y1wRx8avVpQFGUnKNVAADxdUm8FPunRi2DDu252AiUIzkkpHW3kGbqGTQpIFhK6PRBFPw5wKhZEyvMSbBrQwaCZKHqzcazPR90k1GiOvl4iPpXDISmNn5IEdLebb4YPzE-EfmXh71POdNHZ1_MmHNiTUnMC7Bi7U4PivLu4yeH1fADq87FJom4wi-spLVFR90xmHYvZBKKXy9EQ-nH6QexyWlS8yMcWA4zF6P3qatDzPD4R_DoYta_RHkp-_EfiXQniIoHwKpZO8PU24LuafX2V4Z4ZPhkeEx86QrObiZtJRNfm5iutvX4rttpXuhO9HJivrdAcW-7VDU1dIjb1rVTbU4qEPXiElhJ9S-lq2s-XTo9pXpkWPN213DUYim3rbN1B7kvulqLkiTZjWnszR2a-31nJVVJsaV-h2vRberrBzJxpJixJJYhpgDHfrcsBnXObKaWxNTfEMkk2yJ_qMjO3lUKLKfZ6mCh6zaebcpHmaVYNx7XTk9IYczAkN8JwLx9T9Ua7D9D3NMWtZxq_yZ4ZCZPD-bS_B_SSWGQ1EWGQ5Pcdce_wcAAP__-TIjKA">