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

    <tr>
        <th>Summary</th>
        <td>
            Clang fails to compile ranges example from cppreference using libstdc++
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            c++20,
            rejects-valid,
            libstdc++
      </td>
    </tr>

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

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

<pre>
    The example below is taken from: https://en.cppreference.com/w/cpp/ranges
```
#include <ranges>
#include <iostream>
 
int main()
{
    auto const ints = {0,1,2,3,4,5};
    auto even = [](int i) { return 0 == i % 2; };
    auto square = [](int i) { return i * i; };
 
    // "pipe" syntax of composing the views:
    for (int i : ints | std::[views::filter](http://en.cppreference.com/w/cpp/ranges/filter_view)(even) | std::[views::transform](http://en.cppreference.com/w/cpp/ranges/transform_view)(square)) {
        [std::cout](http://en.cppreference.com/w/cpp/io/cout) << i << ' ';
    }
 
    [std::cout](http://en.cppreference.com/w/cpp/io/cout) << '\n';
 
    // a traditional "functional" composing syntax:
    for (int i : std::[views::transform](http://en.cppreference.com/w/cpp/ranges/transform_view)(std::[views::filter](http://en.cppreference.com/w/cpp/ranges/filter_view)(ints, even), square)) {
        [std::cout](http://en.cppreference.com/w/cpp/io/cout) << i << ' ';
    }
}
```

GCC and MSVC both accept it, and Clang can compile it with `-stdlib=libc++`, but fails with `libstdc++`. (https://godbolt.org/z/erv7TbdsG)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNVU1zmzAQ_TVw2YkHCzDJgYONm5x6aqbXjhDCVipLVBJ20l_fXaB27KTttJ1maktISKv9eG_R1rZ5Ku-3EuQj33VaQi21PYDyEPhnaaB1dhelS9iG0HmcROwWmzQz0XVOttJJI-RMoBC7PWDHZXw6bjbSR8k6SpbRIpna-MpSZYTuGwlRWk2C6bvXNpX1wUm-O27DOCgTYMeVidh1xG6mk8VqksEf74MFYY0PgLIeda0BBZKIVXPsDHuKPcOeR8U6Si_Pyj2GPpzKV1G-RkNkU6E10gNOht4ZSEiEpBRELAeGeuBVdf5Lz538tULSs8TVSz0ndSP8OLBOdRIH8E8m8EewLQa866xXZgMB-dwreRgIO55trYPvhoE4HbEpKvChIUls-ep4Ll22SgfpRneJ_9-ln92OGj6RTmKKXROwY9A_tBrwtEdfd39j-Kjkme2RhWE-oH5CZkA2Xx0dErYPf2BdWZrSWTKQVtgGpIdJxArqZ8lBJL9g-N_4Qabzypx58CKtOCBujQrKGq4pydreiPGNUu2UYGPS_Ty73pzeN0ti-m7w6oApmWn6H-fWaXJxEQ_Pu6oCbhp4_-FjBbUNW-BCyA5JDBQXbVUakQDBzZAACmuECnBQKIq6rjAwrWq82vApIraitqCbFuo-QMuV9kdhFEHxk9QMJhhOlWVjm9rqMLNug29fCRm3L-7rxt9h5HFTps1NesPjoIKW5ejaaGS48kf_RuqOJY1qGDxHF_ohi8_ciXunywtf0O2-nqjQev99uOqcfZAiEC3e90OS5ItsXsTbkuc8S5u0va6zLBVFm83zxSKRc5nwQmRFEWuOFdaXVAcYm2wzxIuKEn1yTpJqf7XnWjWn5XPocDlfx6pkCWNJgf88TdJ0JtqGF02esDoTvOZNlCUSC6WekdcEaezKIYC633jc1MoHf9rk3quNkbIci1SMtWtrXfnQG66cjIdYyyHQbwcIaDY">