https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120198
--- Comment #1 from Anthony Cozzolino <ajcozzol at us dot ibm.com> --- Copying the code and compiler error here for convenience: #include <mutex> struct MutexLike { void lock() { } void unlock() { } bool try_lock() { return true; } }; int main() { MutexLike m1, m2; std::lock(m1, m2); std::scoped_lock sl(m1, m2); return 0; } <source>: In function 'int main()': <source>:14:10: error: 'scoped_lock' is not a member of 'std' 14 | std::scoped_lock sl(m1, m2); | ^~~~~~~~~~~ <source>:2:1: note: 'std::scoped_lock' is defined in header '<mutex>'; this is probably fixable by adding '#include <mutex>' 1 | #include <mutex> +++ |+#include <mutex> 2 | Compiler returned: 1