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

    <tr>
        <th>Summary</th>
        <td>
            Incorrect value of requires expression involving discarded value
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:frontend,
            new issue,
            concepts
      </td>
    </tr>

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

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

<pre>
    https://godbolt.org/z/63bf61Esd

```cpp
template <typename T>
bool foo(T x) {
    (int(*)[((void)x, 1)])nullptr; // valid

    return requires {
            (int(*)[((void)x, 1)])nullptr; // clangs returns false
    };
}
bool b = foo(0);
```

When foo a function, `b` is true, if it's a template, `b` becomes false.

replacing `((void)x, 1)` by `1` makes `b` true. but `(void)b` is a discarded value expression so `((void)x, 1)` is a valid constant.
clang is also happy with that expression outside of requires expressions, included in constant evaluated and unevaluated context

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVE-P-yYQ_TTjy2gjjP_EPviQ3Wyk3lfqGcM4piXgAs4m_fQVjrPJrtpeflFk4_n33rwBRAj6aIk6qF6h2mdijqPznXS-sFHbrHfq2o0xTgGKHfAD8MPRqd6ZuHH-CPzwN_BDXfRDnb8HBWwPbLc-a3b7y2m6WSKdJiMiIRRv8TqRFSfCDyjeb-7eOYODc8CbD7wAbxG2rzcXIiLwRtsIvAG-A94mvmndnJ1WwNsL8DfMF8ceeGtnY6booXjFG2s8C6O_EUxFPcXZW_T016w9he-I99-vIksj7DGsWAEHYQI99bXdQ7GipvVDix6h2K-KsFT_K-wu7XM7v49kUzAKHGYro3Y2EYOa9VAz1AGjnymZ9IA6At8GFHifyXNoT9KdaCW6ecbwNBkhtT2m2P8QIRW4Jn-elifxZ5J1rZwYbLCf45q_Jt8JClQ6SOEVqTSumZAuk6cQtLMY3P-DLvnLkFE6G6KwceW-6L_4TXA4imm64qeOI8ZRxGcIN8egFaEbHjvi4Q6LdlaaOfHT9gsGKZEVkRQKq3C2j2_pbKRLvPHIVFeotmhFRl1etyWvypI32dhtK8p7NlRNVUoikTNRtW3LWiV7VraSZ7rjjBesZW3O8qJsNrIYapVz2bOtoqGsoWR0EtpsjDmf0snMdAgzdXXVlHVmRE8mLEec80UNKHaDT9ysAs6BvwHnlj5xyfqySGclTTEkQ7XPfJeqv_TzMUDJjA4xPPCijoa636x03pOM6_z-XUnU9uzMOe2jHwPPZm9-Xjc6jnO_ke4E_JDg1tfL5N0fJCPww8I6pIsotftPAAAA__-_FXP-">