The lambda expression causes testsuite failures such as: FAIL g++.dg/modules/xtreme-header-2_b.C -std=c++26 (test for excess errors)
libstdc++-v3/ChangeLog: * include/bits/semaphore_base.h (_Select_semaphore_impl): Rename to _Semaphore_impl and use std::conditional_t instead of an immediately invoked lambda expression. * include/std/semaphore (counting_semaphore): Adjust to use new name. --- We discovered that I wasn't seeing the modules.exp regressions because those tests always fail for me, because I do all my testing with TBB headers installed. Those seem to use #pragma optimize or the optimize attribute, which can't be used with modules yet. Tested x86_64-linux and sparc-solaris. Pushed to trunk. libstdc++-v3/include/bits/semaphore_base.h | 22 ++++++---------------- libstdc++-v3/include/std/semaphore | 4 ++-- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/libstdc++-v3/include/bits/semaphore_base.h b/libstdc++-v3/include/bits/semaphore_base.h index ebbc9a80b91a..82871ce3518b 100644 --- a/libstdc++-v3/include/bits/semaphore_base.h +++ b/libstdc++-v3/include/bits/semaphore_base.h @@ -289,22 +289,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION alignas(__detail::__platform_wait_alignment) __count_type _M_counter; }; - template<ptrdiff_t _Max> - using _Select_semaphore_impl = typename decltype([] - { - using namespace __detail; - if constexpr (__platform_wait_uses_type<__platform_wait_t>) - { - if constexpr (_Max <= 1) - return type_identity<__platform_semaphore_impl<true>>{}; - else if constexpr (_Max <= __platform_semaphore_impl<false>::_S_max) - return type_identity<__platform_semaphore_impl<false>>{}; - else - return type_identity<__semaphore_impl>{}; - } - else - return type_identity<__semaphore_impl>{}; - }())::type; + template<ptrdiff_t _Max, typename _Tp = __detail::__platform_wait_t> + using _Semaphore_impl + = __conditional_t<__platform_wait_uses_type<_Tp> + && _Max <= __gnu_cxx::__int_traits<_Tp>::__max, + __platform_semaphore_impl<(_Max <= 1)>, + __semaphore_impl>; _GLIBCXX_END_NAMESPACE_VERSION } // namespace std diff --git a/libstdc++-v3/include/std/semaphore b/libstdc++-v3/include/std/semaphore index 8f49188563e8..18d04075776c 100644 --- a/libstdc++-v3/include/std/semaphore +++ b/libstdc++-v3/include/std/semaphore @@ -45,12 +45,12 @@ namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION - template<ptrdiff_t __least_max_value = _Select_semaphore_impl<2>::_S_max> + template<ptrdiff_t __least_max_value = _Semaphore_impl<2>::_S_max> class counting_semaphore { static_assert(__least_max_value >= 0); - _Select_semaphore_impl<__least_max_value> _M_sem; + _Semaphore_impl<__least_max_value> _M_sem; public: constexpr explicit -- 2.49.0