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

    <tr>
        <th>Summary</th>
        <td>
            [libc++][format] Some contiguous ranges cannot be formatted due to lack of `data` member function
        </td>
    </tr>

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

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

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

<pre>
    Example:

```c++
#include <format>
#include <ranges>

using namespace std;

struct Conti {
    const char* begin() const;
    const char* end() const; 
 // const char* data() const;
    // size_t size() const; 
};

static_assert(ranges::contiguous_range<Conti>);
static_assert(ranges::sized_range<Conti>);
static_assert(formattable<Conti, char>);

int main() {
    Conti conti;
    (void) format("{}\n", conti);
}
```

Expected: *correct compilation with `-fsyntax-only`*

Got:
```console
/opt/compiler-explorer/clang-trunk-20230120/bin/../include/c++/v1/__format/range_formatter.h:172:67: error: no member named 'data' in 'Conti'
      return __formatter.format(basic_string_view<_CharT>{__range.data(), __range.size()}, __ctx);
                                                          ~~~~~~~ ^
[MORE LINES]
```

Possible solution:
https://github.com/llvm/llvm-project/blob/097f42602d83926a9d5e7fbe3d0bb8ef5c733183/libcxx/include/__format/range_formatter.h#L172

We should use `ranges::data` and `ranges::size` here.

Compiler explorer: https://godbolt.org/z/M4jPhM9Pv
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVUlv4zYU_jX05cGGTFrbwQcvUdFi0g46BXo0uDxbnKFJg6QSJ4f-9oKSvCQzDTA1BMrk28jv-x7FQ9AHi7gk-Zrk2wnvYuv88rdH_tr5bxqftXydCKdelg9nfjwZJGxFsi3JLmORDY8kdJ2eYZUybaXpFAJhm73zRx4Je_iR0XN7wHAz9mMXtD2A5UcMJy4RQlSEre89QvSdjLBxNmog5WgDAJDOhgiy5Z7QFQg8aEtoRWg9WK55vvd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