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

    <tr>
        <th>Summary</th>
        <td>
            `<ranges>`: `ranges::to` use range-based for loops in append branches
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    https://github.com/llvm/llvm-project/blob/6c062afc2e6ed4329e1e14cb011913195a5356fa/libcxx/include/__ranges/to.h#L112-L124

Range-based for loop is not guaranteed to be well-formed for `input_range` as it does not extract iterator-pair through `ranges::begin`/`ranges::end`:

https://godbolt.org/z/Kc3dsvnfW

```cpp
#include <ranges>

struct Vector {
  void push_back(int);
};

struct OnlyADLRange {
  void begin() = delete;
  void end() = delete;
  friend int* begin(OnlyADLRange&);
  friend int* end(OnlyADLRange&);
};

int main() {
  std::ranges::contiguous_range auto r = OnlyADLRange{};
  auto v = r | std::ranges::to<Vector>(); // only well-formed in libstdc++
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVEtv4zYQ_jXjC2FDGtqSddBBTqpLAxTooT0GfIwkdhlSICkn6a8vKHmzTrB7KEDAj_nm8c3MNyJGMzqiFk4XOD3uxJImH9qJXo2133bS6_d2SmmOwDvAHrAfTZoWeVD-BbC39vr9Yz8H_w-pBNhL6yVgX6miQjEopIr0kWNDJZVHJYuybEpeNidx4qdqEDmAkertDbA3TtlFE2D__ByEGykC9skfJkD-VJa4fyrxCEUHRfdnNu-liKTZ4AOz3s_MROZ8YuMignCJSLPkmST2StbuBx9ebmCoCuPmJW1JoCqYiMwkpj1tEegtBaESM4mCSD7sZ2ECS1Pwyzhl91t1vAPeSRqNg6rIHfpsIafz_7zbav7SSq-lt-ngwwjY_wvY_664jlc3_L3Bs-v61Dznn8hv_WHAH76n-W3DxhQWldhfpFLmV1-g6Bi7eqPZvMTpWQr1DfBsXAJsgGcz1I-3Lx_ufzj73j0-rb39HGTjiGfAhgF_ZJosJdr8b5BM9leAIRhymq3pu49g9-kAq4_KvuK3yL9C3_MwLrEX8aPSG4WY9DaQ--Eo75IZF7_EbQ2YWJJnYa3-U6768pGCbaDrCsp9fvh57OSBP2zDyCNaqwF-YdvkmXf2_dNSGseskTFpBXjJb6N1twM73XLd8EbsqC1rzqu6xmO9m9qhqgeujnSuK1FrjXWj5LnBYhDET81AO9NigccSi3NZF8WRHwRyUcrziarzIFHWcCzoRRh7yELO67gzMS7UrkLlOysk2bieCERHr2y1AmK-GKFd1S-XMcKxsCam-CNMMslSuyrgbl9XQXzVUPJZhUskFn4i7JgbJOY574QMwqmJ4m4J9v8fp7X2fFVu5K4t_hcAAP__OZ6HfQ">