Bug 1542132 - ambiguous overload for 'operator!=' for 'std::error_code's
Summary: ambiguous overload for 'operator!=' for 'std::error_code's
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
Assignee: Jonathan Wakely
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-02-05 16:12 UTC by Marek Skalický
Modified: 2018-02-12 11:43 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2018-02-12 11:43:14 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
compile errors (15.78 KB, text/plain)
2018-02-05 16:12 UTC, Marek Skalický
no flags Details


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 84283 0 None None None 2018-02-08 14:40:16 UTC

Description Marek Skalický 2018-02-05 16:12:05 UTC
Created attachment 1391605 [details]
compile errors

Description of problem:
I have FTBFS mongodb error in Fedora Rawhide (now combined with unresolvable dependencies error). Based on koschei information [1] I think this problem is caused by gcc 8 update.

Error is in bundled asio library.

I can see similar error messages:

src/third_party/asio-master/asio/include/asio/basic_socket_streambuf.hpp:463:15: error: ambiguous overload for 'operator!=' (operand types are 'asio::error_code' {aka 'std::error_code'} and 'asio::error::basic_errors')
       if (ec_ != asio::error::would_block
           ~~~~^~~~~~~

/usr/include/c++/8/system_error:319:3: note: candidate: 'bool std::operator!=(const std::error_code&, const std::error_code&)'
   operator!=(const error_code& __lhs, const error_code& __rhs) noexcept
   ^~~~~~~~
/usr/include/c++/8/system_error:323:3: note: candidate: 'bool std::operator!=(const std::error_code&, const std::error_condition&)'
   operator!=(const error_code& __lhs, const error_condition& __rhs) noexcept
   ^~~~~~~~
/usr/include/c++/8/system_error:327:3: note: candidate: 'bool std::operator!=(const std::error_condition&, const std::error_code&)'
   operator!=(const error_condition& __lhs, const error_code& __rhs) noexcept
   ^~~~~~~~
/usr/include/c++/8/system_error:331:3: note: candidate: 'bool std::operator!=(const std::error_condition&, const std::error_condition&)'
   operator!=(const error_condition& __lhs,
   ^~~~~~~~


But code below is defined and is_error_condition_enum isn't defined!

namespace std {

template<> struct is_error_code_enum<asio::error::basic_errors>
{
  static const bool value = true;
};
}

Used asio code can be browsed in [2]. IMHO related code is in asio/include/asio/error_code.hpp and asio/include/asio/error.hpp (ASIO_HAS_STD_SYSTEM_ERROR is defined). I was trying to separate a reproducer, but I wasn't successful.

What's wrong? What changed in gcc8?

Version-Release number of selected component (if applicable):
gcc-c++-8.0.1-0.9.fc28.x86_64
libstdc++-8.0.1-0.9.fc28.x86_64

How reproducible:
Always in Fedora Rawhide when building mongodb package.

Steps to Reproduce:
1. 'fedpkg prep' for mongodb package (master branch in rawhide OS)
2. dnf builddep for mongodb
3. in unpacked source run 'scons-3 build/fedora/mongo/executor/network_interface_asio_operation.o $(cat build-options)'

Actual results:
In attached log.

Expected results:
No 'error: ambiguous overload for 'operator!=''

Additional info:
[1] https://apps.fedoraproject.org/koschei/package/mongodb?collection=f28 check from 2018-01-30 11:44:02
[2] https://github.com/mongodb/mongo/tree/v3.6/src/third_party/asio-master

Comment 1 Marek Skalický 2018-02-08 14:16:26 UTC
Any idea how to workaround this?

Comment 2 Jonathan Wakely 2018-02-08 14:40:16 UTC
Reduced:

#include <system_error>

namespace asio { namespace error {
  struct basic_errors { };

  std::error_code make_error_code(basic_errors);
} }

namespace std {

template<> struct is_error_code_enum<asio::error::basic_errors> : true_type { };
}

template<typename> struct Y { };

template<typename T>
struct X : Y<T> {
  void f()
  {
    std::error_code ec;
    asio::error::basic_errors err;
    ec == err;
  }
};

This is the same GCC bug as Bug 1542254 and I don't know a workaround.

Comment 3 Jonathan Wakely 2018-02-09 20:37:43 UTC
This has now been fixed upstream, so should get fixed next time GCC is updated in rawhide.

Comment 4 Marek Skalický 2018-02-12 11:43:14 UTC
Jonathan, thanks for solving this problem.

It is fixed in gcc-8.0.1-0.13.fc28.


Note You need to log in before you can comment on or make changes to this bug.