Closed
Description
https://godbolt.org/z/Kvr6afWd4
template<typename T> concept doesnt_matter = true;
template<class T>
concept test =
[]{
return requires(T t) {
{ t } -> doesnt_matter;
};
}();
static_assert(test<int>);
It is reduced from https://godbolt.org/z/5K6janbx5
#include <concepts>
#include <type_traits>
#include <utility>
#include <tuple>
template<class T>
concept tuple_like =
[] <std::size_t...I> (std::index_sequence<I...>) {
return ((requires(T t) {
{ std::get<I>(t) } -> std::convertible_to<std::tuple_element_t<I, T>&>;
}) && ...);
} (std::make_index_sequence<std::tuple_size_v<T>>{});
static_assert(tuple_like<std::tuple<int>>);
Both were accepted by Clang 15 and earlier. Clang 16 and current trunk on CompilerExplorer crashes on them(with either libc++ or libstdc++), but accepts the second if std::tuple_element_t<I, T>&
is replaced with int&
.
GCC also has this issue on the second example only: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105644.
MSVC accepts them.