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

    <tr>
        <th>Summary</th>
        <td>
            [clang][libc++] std::expected not available until clang 20
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang,
            libc++
      </td>
    </tr>

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

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

<pre>
    The following code doesn't compile until clang 20:

```cpp
#include <expected>

using type = std::expected<int, int>;
```

The compiler reports the following error (when using `-std=gnu++23`):

```
<source>:3:14: error: use of undeclared identifier 'std'
    3 | using type = std::expected<int, int>;
      | ^
```

According to [the reference for C++23 support in libc++](https://libcxx.llvm.org/Status/Cxx23.html), `std::expected` has been supported in clang 16 onward.

It seems as though the feature macro isn't defined in the previous versions for some reason.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycU0-PuzYQ_TTmMtrIjEMIBw4J2Ug9t1_A2JPgytjIf7L5ffvKJNvNdtUeihAGM35v3psZGaO5OqKeNUfWnCqZ0-RDr-XHrKvR61_9HxPBxVvrP4y7gvKaQHuKjmGbQPl5MZYgu2QsKCvdFZAzcWD8xPjnc8cft1qW5w4K45TNmoCJge4LqUSaiffXYzkWwvRrKUEniEkXXHH4Ch-MSwwHKIt4Z-L4D75XtCLjmW2AQIsPKUL6po1C8AEY7j8mcvCgZzv-tjKfri4zPDI8oijQ2P2byuenGKLPQdGa2UEwcai3TBweLOUlRwJ_gew0KSsDaTCaXDIXQyWLttBi-0ADABDA2gH-tyuwXgWCNe__YdRBKR_0SuKBNcfiUaALBXKquBVg-PQBYl6KkWAcWDOqxz5rTgz3U0pLLKnhmeG5_L3fN9be5o0PV4bn35NMOTI8D_c7is2UZls8xaFY_lPVjsMkI4xE7pO1GOaePVfvwLsPGfTmVcpvCSLRHEGWUvt8nR4VJ5lyIJilCh7Ms5U1XYx7YJagJdDN-BzhRiEa7-IqPfq5uCGjd5tK90J3opMV9XWLTbfrmp2opn7cio40l-1WktLduB8lUsMv7YXvOSpVmR45bnlX87puOhSbcS_bWiPtuFS8lSPbcpqlsX8bVpkYM_U13_O6rqwcycZ1ZBFXAxgiw4EhvpQBsQx06AvG25ivkW25NTHFL9Rkkl1H_wHSnFhz_FbIn_0FzieQN2msHH8MfpWD7b9X_mrSlMeN8nNpA3v7XN6W4P8klRieV22lFZ7ybj3-FQAA__-zMWSr">