https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103831
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot
gnu.org
Last reconfirmed| |2021-12-26
CC| |ppalka at gcc dot gnu.org
Status|UNCONFIRMED |ASSIGNED
--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Interestingly, adding the (correct and passing) assert
static_assert(!std::ranges::__detail::__tiny_range<decltype(p)>);
before the last line causes us to reject the last line with
/home/patrick/code/gcc/libstdc++-v3/include/std/ranges:2953:12: error:
satisfaction value of atomic constraint
‘requires{std::ranges::__detail::__require_constant<(std::remove_reference<_Tp>::type::size)()>;}
[with _Range = std::span<int, 1>]’ changed from ‘false’ to ‘true’
Looks like this is indeed a frontend bug, which can be distilled into the
testcase
struct A {
constexpr int size() { return 42; }
};
template<class T>
struct B : T {
static_assert(A::size() == 42);
};
We incorrectly accept the non-dependent call A::size() here even though it's
being performed from a context where there is no 'this' object.