https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92138
Bug ID: 92138
Summary: Compiler does not define __CPP_THREADS__ when multiple
threads are supported
Product: gcc
Version: 9.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: alisdairm at me dot com
Target Milestone: ---
According to [cpp.predefined], the __CPP_THREADS__ macro should be (implicitly)
predefined "if and only if a program can have more than one thread of
execution".
I believe this is entirely dependent on the memory model, and the necessary
ordering guarantees that are likely to impact optimizers etc. (whether data
races are a thing to worry about or not) and totally unrelated to library
support for the <thread> header, etc.
This requirement was added for C++11, but from my attempts at searching
Bugzilla, I have not found any other reports featuring the token
"__CPP_THREADS__", which means either my search skills are sadly wanting, or
this is not a highly requested feature. My research of other C++11 compilers
suggests that the Intel compiler (EDG front end) and Microsoft compilers
correctly define this macro, and the Clang folks already have bug reports
tracking this.