[Bug c++/82171] Cant use std::declval in concept testing map operator[]

rwdougla at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Sep 11 01:31:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82171

--- Comment #1 from Robert Douglas <rwdougla at gmail dot com> ---
I came about this, transitioning from habits using SFINAE. I have just realized
I can simplify it to:
template<typename T>
concept bool MapLike = requires(T t) {
    {t[typename T::value_type::first_type{}]}
        -> typename T::value_type::second_type;
};

and bypass the declval, altogether. Question, though, does anything forbid
declval in this context?


More information about the Gcc-bugs mailing list