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

--- Comment #3 from David Edelsohn <dje at gcc dot gnu.org> ---
#include <stdio.h>
#include <thread>
using namespace std;

int main(void)
{
        int maxThreads = thread::hardware_concurrency();
        printf("maxThreads: %d\n", maxThreads);
        return(0);
}

$ g++ -pthread /tmp/nameclash.cpp -o /tmp/nc
/tmp/nameclash.cpp: In function 'int main()':
/tmp/nameclash.cpp:7:19: error: reference to 'thread' is ambiguous
  int maxThreads = thread::hardware_concurrency();
                   ^~~~~~
In file included from /tmp/nameclash.cpp:2:
/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/include/c++/thread:62:9: note:
candidates are: 'class std::thread'
   class thread
         ^~~~~~
In file included from /usr/include/sys/ptrace.h:28,
                 from /usr/include/sys/proc.h:44,
                 from /usr/include/sys/pri.h:43,
                 from /usr/include/sys/sched.h:38,
                 from /usr/include/sched.h:51,
                 from /usr/include/pthread.h:63,
                 from
/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/include/c++/powerpc-ibm-aix7.2.0.0/pthread/bits/gthr-posix.h:35,
                 from
/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/include/c++/powerpc-ibm-aix7.2.0.0/pthread/bits/gthr-default.h:30,
                 from
/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/include/c++/powerpc-ibm-aix7.2.0.0/pthread/bits/gthr.h:148,
                 from
/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/include/c++/ext/atomicity.h:35,
                 from
/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/include/c++/memory:73,
                 from
/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/include/c++/thread:39,
                 from /tmp/nameclash.cpp:2:
/usr/include/sys/thread.h:106:8: note:                 'struct thread'
 struct thread {
        ^~~~~~

Reply via email to