Issue 87178
Summary `__restrict` pointers are not `indirectly_readable`
Labels new issue
Assignees
Reporter kedartal
    For example,
```c++
void f( double * __restrict ptr ) {
    using ptr_t = decltype(ptr);
 static_assert(!std::indirectly_readable<ptr_t>);
 static_assert(!std::is_same_v<std::remove_cv_t<ptr_t>, double *>);
}
```
```
concepts.h(127, 59): Because 'const double *__restrict' does not satisfy 'indirectly_readable'
concepts.h(65, 31): Because 'remove_cvref_t<const double *__restrict>' (aka 'const double *__restrict') does not satisfy '__indirectly_readable_impl'
iterator_traits.h(519, 1): Because 'typename iter_value_t<_In>' would be invalid: no type named 'value_type' in 'std::indirectly_readable_traits<const double *__restrict>'
```
([Godbolt](https://godbolt.org/z/61EM4crG6))

This makes the standard `std::advance` and related functionality unavailable for such pointers (yet `std::ranges::advance` works fine, for whoever needs an immediate fix).

I think `__restrict` should be stripped out of the type, but instead it gets treated syntactically as if is were a `const` or `volatile` qualifier.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to