[Bug c++/84283] [8 Regression] std::map::insert(const_iterator, P&&) now ambiguous with std::map::insert(InputIterator, InputIterator)

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Feb 8 14:47:00 GMT 2018


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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Another example from https://bugzilla.redhat.com/show_bug.cgi?id=1542132

namespace std {

  struct true_type { static constexpr bool value = true; };
  struct false_type { static constexpr bool value = false; };

  template<bool, typename = void> struct enable_if { };
  template<typename T> struct enable_if<true, T> { using type = T; };

  template<typename> struct is_error_code_enum : false_type { };
  template<typename> struct is_error_condition_enum : false_type { };

  struct error_condition
  {
    error_condition() = default;

    template<typename E, typename = typename
         enable_if<is_error_condition_enum<E>::value>::type>
      error_condition(E)
      { }
  };

  struct error_code
  {
    error_code() = default;

    template<typename E, typename = typename
         enable_if<is_error_code_enum<E>::value>::type>
      error_code(E)
      { }
  };

  bool operator==(const error_code&, const error_code&);

  bool operator==(const error_code&, const error_condition&);
} // std

struct Error { };

namespace std {
template<> struct is_error_code_enum<Error> : true_type { };
}

template<typename> struct Y { };

template<typename T>
struct X : Y<T> {
  bool f()
  {
    std::error_code ec;
    Error err;
    return ec == err;
  }
};


More information about the Gcc-bugs mailing list