[Bug c++/91466] [concepts] indicates "used in its own initializer" when not, constraint order change passes compilation.
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Oct 29 10:40:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91466
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |10.0
Blocks| |67491
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Compiles on current trunk after changing the return type constraint:
#include <concepts>
#include <array>
template<typename T>
concept integral_constant_ = std::is_empty_v<T> && std::is_trivial_v<T> &&
requires
{
typename T::value_type;
requires std::is_integral_v<typename T::value_type>;
{ T::value } -> std::same_as<typename T::value_type>;
};
struct sz_fn
{
template<typename R> requires requires(R&& r) { {static_cast<R&&>(r).size()} ->
integral_constant_; }
constexpr auto operator()(R&& r) {
return static_cast<R&&>(r).size();
}
};
constexpr auto sz = sz_fn{};
int main()
{
auto arr = std::array<int, 5>{1, 2, 3, 4, 5};
return !std::is_invocable_v<decltype(sz), decltype(arr)>;
}
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
[Bug 67491] [meta-bug] concepts issues
More information about the Gcc-bugs
mailing list