https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109049
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The reason it behaves this way is that we define declval as:
template<typename _Tp>
auto declval() noexcept -> decltype(__declval<_Tp>(0));
and decltype(__declval<_Tp>(0)) drops the cv-qualifiers. This implementation is
much faster to compile, and so we're not going to stop using it to "fix" the
useless testcase in this bug. Nobody cares about decltype(std::declval<const
void>) but they do care about compile times.