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

            Bug ID: 95545
           Summary: thread:: conflicts with std::thread
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dje at gcc dot gnu.org
  Target Milestone: ---

AIX, MSVC, and possibly other systems, implemented their own definition of
thread different from Posix threads.

libstdc++ <thread> header eventually includes <gthr-posix.h>, which includes
the system <pthread.h> header, which, on AIX, eventually includes
<sys/thread.h>

The AIX header nicely does

#ifdef __cplusplus
extern "C" {
#endif

struct  thread {
...
}

which creates an ambiguity when a user references thread:: without std::thread.

LLVM C++ has a pattern that helps to avoid the conflict because of a similar
problem for MSVC:

namespace llvm {
typedef std::thread thread;
}

llvm/include/llvm/Support/thread.h

Would libstdc++ consider a similar solution?

Reply via email to