This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/68307] New: [mingw32] Missing enum values in std::errc


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

            Bug ID: 68307
           Summary: [mingw32] Missing enum values in std::errc
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: beck.ct at gmail dot com
  Target Milestone: ---

I originally encountered this problem when trying to cross-compile a C++
program using websocketpp to communicate using websockets, using the mingw-w64
toolchain.

The problem is that the libstdc++ header file
`libstdc++-v3/config/os/mingw32-w64/error_constants.h` comments out a large
number of enum values for the enum `std::errc` which are not optional and are
required by the C++11 standard to exist. In particular, I get this error
related to `std::errc::operation_canceled`:

```
In file included from
websocketpp-0.6.0/include/websocketpp/config/asio_no_tls_client.hpp:32:0,
from main.cpp:31:
websocketpp-0.6.0/include/websocketpp/transport/asio/endpoint.hpp: In member
function âvoid
websocketpp::transport::asio::endpoint<config>::handle_accept(websocketpp::transport::accept_handler,
const error_code&)â:
websocketpp-0.6.0/include/websocketpp/transport/asio/endpoint.hpp:764:28:
error: âoperation_canceledâ is not a member of âstd::errcâ
if (asio_ec == lib::asio::errc::operation_canceled) {
^
```

It compiles fine when using g++.

For simplicity, here is a trivial program which I believe conforms to the
standard but is prevented from compiling on mingw because of this problem:

```
#include <system_error>

int main() {
  std::errc temp;
  if (temp == std::errc::operation_canceled) {
    return 1;
  }
  return 0;
}
```

In the C++11 standard section 19.5.2, the symbol
`std::errc::operation_canceled` is provided in the `<system_error>` synopsis,
and its existence is not listed as optional.

Further, 19.5.3 states that "The value of each enum errc constant shall be the
same as the value of the <cerrno> macro shown in
the above synopsis."

It was suggested to me on irc that this is a libstdc++ bug and not a mingw-w64
bug.

Cross-links to this issue on other issue trackers:
- Mingw-w64: http://sourceforge.net/p/mingw-w64/support-requests/105/
- websocketpp: https://github.com/zaphoyd/websocketpp/issues/478

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]