https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116752
Bug ID: 116752 Summary: Implementation detail leakes to <thread> header - "write" func is being pulled in Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: sinbal2l at gmail dot com Target Milestone: --- When including <thread> header, func is leaking from implementation, which captures the name "write": https://godbolt.org/z/PanTaEWz6 ``` #include <thread> void write() {} int main() { write(1, v, 4); // Works in gcc (when it shouldn't!) typedef void(*funcptr)(); funcptr ptr = write; std::jthread t1(ptr); // OK std::jthread t4(write); // Ambiguity failure - caused by pulling the // wrong "write" to the global namespace } ``` Fix needed: put in namespace / wrap functions in the C header to preven leak https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/std/thread (Opening bug for decomentation, as I got some feedback that the bug is unlikely to be fixed)