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

    <tr>
        <th>Summary</th>
        <td>
            `__attribute__((enable_if(...)))` checked before constraints
        </td>
    </tr>

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

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

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

<pre>
    When using `__attribute__((enable_if(...)))` with a condition that may be ill-formed, you cannot use a `requires` clause to constrain the function to only be considered in the well-formed cases, because apparently the `enable_if` condition is considered first.

The workaround is to use SFINAE instead, which is ugly.

Sample code: https://godbolt.org/z/x3MjWv1ET

IMO, enable_if should be considered after constraint satisfaction (like with SFINAE), not before.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUksFO4zoUhp_G2VhEjt20zSKLXiASC-5dgMSyOnFOElPX7rWPYTpPP3LaAYbdSFUjRX--3985hhjN5BBbVv_D6rsCEs0-tKcDRDJuKno_nNuXGR1P0biJs7XY74EomD4R7vdMbpncooPe4t6MTG7LsmSyuf7Wgr8bmjlw7d1gyHjHaQbiRzjzHrmx9mb04YgDk7f87BPX4JwnniJyyG0B_08mYMwobSG_J59pkQKYTEM-JqcvaM-9sws5J8yAAQd-Tb3jRxnXEDHmyh71woTTCQI6sucly9bi0yk3f5zexK_o0YRIJRN3TOwu_8-5yYcDBJ_ckOPkF5un7uHf3T03LhLCovs-Gz3nRJrs-Q_IExxPNjsMyNSOz0SnyNSOyY7JbvJD7y2VPkxMdj-Z7H6ox9eXt-r--Svj4fG_XPKhwePskx2-zQZGwvA5TuIRyMQRLvNkcmvNAS87vAgsi73leUc9jj5gWQytGhrVQIFttVGiUauqrou5XatRVZtVVUMtcQ1aQ79pNoh1o3q10pvCtFLIVVWJtVRCqrpECQLGRkm1QVRqZCuBRzC2tPbtmIULE2PCtqpqqURhoUcbf1_d0ObUTZ-myFbCmkjx8zsyZLH9-9urZ9QHHK6uXwYVixRs-20zhubUl9ofmexy9fVxcwr-FTUx2S3nj0x2V4W3Vv4KAAD__wGhJR0">