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

            Bug ID: 120198
           Summary: std::scoped_lock disabled for non-gthread environments
                    (such as arm-none-eabi)
           Product: gcc
           Version: 14.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ajcozzol at us dot ibm.com
  Target Milestone: ---

At some point, the definition for __cpp_lib_scoped_lock in <mutex> was changed
to depend on gthread. This check causes std::scoped_lock to be compiled out for
non-gthread environments such as arm-none-eabi.

I believe this is a regression as std::scoped_lock is an RAII wrapper for
std::lock(), which works perfectly fine. The definition of scoped_lock did not
change, simply the #define guarding its inclusion.

Suggested fix: remove the dependency on _GLIBCXX_HAS_GTHREADS in the
__cpp_lib_scoped_lock definition in version.h.

Compiler Explorer link: https://godbolt.org/z/39W3d93fY

Reply via email to