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

--- Comment #3 from Marc Mutz <marc at kdab dot com> ---
Indeed, I didn't check that it actually fails in SFINAE. Sorry for that.

This works:

  // https://godbolt.org/z/EfJmS4
  #include <utility>
  #include <experimental/type_traits>

  template <typename From, typename To>
  using nonnarrowing_test = decltype(To{std::declval<From&>()});

  template <typename From, typename To>
  using is_narrowing =
std::negation<std::experimental::is_detected<nonnarrowing_test, From, To>>;

  static_assert(is_narrowing<long double, double>{});
  static_assert(!is_narrowing<double, long double>{});

Reply via email to