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

2015-11-11 Thread beck.ct at gmail dot com
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::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 

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 `` 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  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

[Bug c++/72845] New: gcc crashes (ICE) when compiling program with complex noexcept declaration

2016-08-08 Thread beck.ct at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72845

Bug ID: 72845
   Summary: gcc crashes (ICE) when compiling program with complex
noexcept declaration
   Product: gcc
   Version: 6.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: beck.ct at gmail dot com
  Target Milestone: ---

Created attachment 39083
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39083&action=edit
variant.cpp compiling at C++11 causes ICE in versions 5+ of gcc that I tested

* Exact version of gcc:

  I reproduced this bug against 

gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.1)

  and

gcc version 6.1.1 20160510 (Ubuntu 6.1.1-2ubuntu12~16.04)

  I don't get an ICE with gcc 4.9.

* System type is Ubuntu linux:

  DISTRIB_DESCRIPTION="Ubuntu 16.04.1 LTS"


* Configuration options used to build gcc:

  My `gcc-6 -v` reports this:

  $ gcc-6 -v
  Using built-in specs.
  COLLECT_GCC=gcc-6
  COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper
  Target: x86_64-linux-gnu
  Configured with: ../src/configure -v --with-pkgversion='Ubuntu
6.1.1-2ubuntu12~16.04' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs
--enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-6 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib
--disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
  Thread model: posix
  gcc version 6.1.1 20160510 (Ubuntu 6.1.1-2ubuntu12~16.04) 

* Complete command line that triggers the crash:

  $(CXX) -std=c++11 variant.cpp

* the compiler output (error messages, warnings, etc.):

  $ gcc-5 -std=c++11 variant.cpp
variant.cpp: In instantiation of ‘template
decltype
(declval().get_visitor_dispatch()(declval().which(),
forward(declval()).storage(),
forward(declval( strict_variant::apply_visitor(Visitor&&,
Visitable&&)’:
variant.cpp:578:15:   required from ‘class strict_variant::variant’
variant.cpp:637:89:   required from here
variant.cpp:578:15: internal compiler error: in push_access_scope, at
cp/pt.c:232
   friend auto apply_visitor(Visitor &&, Visitable &&)
noexcept(APPLY_VISITOR_UNEVALUATED_EXPR)
   ^
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.

  $ gcc-6 -std=c++11 variant.cpp
variant.cpp: In instantiation of ‘template
decltype
(declval().get_visitor_dispatch()(declval().which(),
forward(declval()).storage(),
forward(declval( strict_variant::apply_visitor(Visitor&&,
Visitable&&)’:
variant.cpp:578:15:   required from ‘class strict_variant::variant’
variant.cpp:637:89:   required from here
variant.cpp:578:15: internal compiler error: in push_access_scope, at
cp/pt.c:229
   friend auto apply_visitor(Visitor &&, Visitable &&)
noexcept(APPLY_VISITOR_UNEVALUATED_EXPR)
   ^
0x5fb0bb push_access_scope
../../src/gcc/cp/pt.c:228
0x62122f maybe_instantiate_noexcept(tree_node*)
../../src/gcc/cp/pt.c:21603
0x5dce98 check_redeclaration_exception_specification
../../src/gcc/cp/decl.c:1221
0x5eb12d duplicate_decls(tree_node*, tree_node*, bool)
../../src/gcc/cp/decl.c:2022
0x6e020f push_overloaded_decl_1
../../src/gcc/cp/name-lookup.c:2396
0x6e020f push_overloaded_decl
../../src/gcc/cp/name-lookup.c:2491
0x6e2d12 pushdecl_maybe_friend_1
../../src/gcc/cp/name-lookup.c:915
0x6e2d12 pushdecl_maybe_friend(tree_node*, bool)
../../src/gcc/cp/name-lookup.c:1298
0x6e3e43 pushdecl_with_scope_1
../../src/gcc/cp/name-lookup.c:2295
0x6e3f2c pushdecl_with_scope(tree_node*, cp_binding_level*, bool)
../../src/gcc/cp/name-lookup.c:2309
0x6e3fa8 pushdecl_namespace_level(tree_node*, bool)
../../src/gcc/cp/name-lookup.c:3915
0x6223ae tsubst_friend_function
../../src/gcc/cp/pt.c:9265
0x6223ae instantiate_class_template_1
../../src/gcc/cp/pt.c:10261
0x6223ae instantiate