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

--- Comment #1 from MichaƂ Dominiak <griwes at griwes dot info> ---
This bug makes it seem (in SFINAE contexts) that std::string is constructible
from double with an initializer-list constructor, without narrowing:

#include <string>
#include <type_traits>

using std::void_t;

template<typename T, typename U, typename = void>
struct is_nonnarrowing_conversion : std::false_type {};

template<typename T, typename U>
struct is_nonnarrowing_conversion<T, U,
    void_t<decltype(T{ std::declval<U>() })>> : std::true_type {};

static_assert(!is_nonnarrowing_conversion<std::string, double>());

Reply via email to