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

            Bug ID: 93151
           Summary: system_error header fails to compile with
                    -D_XOPEN_SOURCE=600
           Product: gcc
           Version: 9.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: karen.arutyunov at gmail dot com
  Target Milestone: ---

Trying to build ICU 65.1 on macOS 10.15.2 with g++ 9.2.0 (Homebrew GCC 9.2.0_2)
ends up with the error:

In file included from
/usr/local/Cellar/gcc/9.2.0_1/include/c++/9.2.0/system_error:39,
                 from
/usr/local/Cellar/gcc/9.2.0_1/include/c++/9.2.0/bits/std_mutex.h:39,
                 from
/usr/local/Cellar/gcc/9.2.0_1/include/c++/9.2.0/condition_variable:39,
                 from ../../common/umutex.h:24,
                 from ../../common/putil.cpp:68:
/usr/local/Cellar/gcc/9.2.0_1/include/c++/9.2.0/x86_64-apple-darwin19/bits/error_constants.h:135:24:
error: 'EOWNERDEAD' was not declared in this scope
  135 |       owner_dead =     EOWNERDEAD,
      |                        ^~~~~~~~~~
/usr/local/Cellar/gcc/9.2.0_1/include/c++/9.2.0/x86_64-apple-darwin19/bits/error_constants.h:151:34:
error: 'ENOTRECOVERABLE' was not declared in this scope
  151 |       state_not_recoverable =    ENOTRECOVERABLE,
      |                                  ^~~~~~~~~~~~~~~

The issue seems to relate to libstdc++ headers and pops up if a program defines
_XOPEN_SOURCE as 600 and includes the system_error header. It can be reproduced
with the following commands:

% cat <<EOF >test.cxx
#include <system_error>

int main (int argc, char* argv[])
{
}
EOF

% g++-9 test.cxx

% g++-9 -D_XOPEN_SOURCE=600 test.cxx
In file included from
/usr/local/Cellar/gcc/9.2.0_2/include/c++/9.2.0/system_error:39,
                 from test.cxx:1:
/usr/local/Cellar/gcc/9.2.0_2/include/c++/9.2.0/x86_64-apple-darwin19/bits/error_constants.h:135:24:
error: 'EOWNERDEAD' was not declared in this scope
  135 |       owner_dead =     EOWNERDEAD,
      |                        ^~~~~~~~~~
/usr/local/Cellar/gcc/9.2.0_2/include/c++/9.2.0/x86_64-apple-darwin19/bits/error_constants.h:151:34:
error: 'ENOTRECOVERABLE' was not declared in this scope
  151 |       state_not_recoverable =    ENOTRECOVERABLE,
      |                                  ^~~~~~~~~~~~~~~

Reply via email to