2222
2323#include < cstddef>
2424
25+ #if STDEXEC_GCC()
26+ // GCC (as of v14) does not implement the resolution of CWG1835
27+ // https://cplusplus.github.io/CWG/issues/1835.html
28+ // See: https://godbolt.org/z/TzxrhK6ea
29+ # define STDEXEC_NO_CWG1835
30+ #endif
31+
32+ #ifdef STDEXEC_NO_CWG1835
33+ # define STDEXEC_CWG1835_TEMPLATE
34+ #else
35+ # define STDEXEC_CWG1835_TEMPLATE template
36+ #endif
37+
2538namespace stdexec {
2639 namespace __tup {
2740 template <class _Ty , std::size_t _Idx>
@@ -56,12 +69,13 @@ namespace stdexec {
5669 struct __tuple <_Idx, _Ts...> : __box<_Ts, _Is>... {
5770 template <class ... _Us>
5871 static __tuple __convert_from (__tuple<_Idx, _Us...> &&__tup) {
59- return __tuple{{static_cast <_Us &&>(__tup.template __box <_Us, _Is>::__value)}...};
72+ return __tuple{
73+ {static_cast <_Us &&>(__tup.STDEXEC_CWG1835_TEMPLATE __box<_Us, _Is>::__value)}...};
6074 }
6175
6276 template <class ... _Us>
6377 static __tuple __convert_from (__tuple<_Idx, _Us...> const &__tup) {
64- return __tuple{{__tup.template __box <_Us, _Is>::__value}...};
78+ return __tuple{{__tup.STDEXEC_CWG1835_TEMPLATE __box<_Us, _Is>::__value}...};
6579 }
6680
6781 template <class _Fn , class _Self , class ... _Us>
@@ -70,12 +84,13 @@ namespace stdexec {
7084 apply (_Fn &&__fn, _Self &&__self, _Us &&...__us) //
7185 noexcept (noexcept (static_cast <_Fn &&>(__fn)(
7286 static_cast <_Us &&>(__us)...,
73- static_cast <_Self &&>(__self).template __box<_Ts, _Is>::__value...)))
87+ static_cast <_Self &&>(__self).STDEXEC_CWG1835_TEMPLATE __box<_Ts, _Is>::__value...)))
7488 -> decltype (static_cast <_Fn &&>(__fn)(
7589 static_cast <_Us &&>(__us)...,
76- static_cast<_Self &&>(__self).template __box<_Ts, _Is>::__value...)) {
90+ static_cast<_Self &&>(__self).STDEXEC_CWG1835_TEMPLATE __box<_Ts, _Is>::__value...)) {
7791 return static_cast <_Fn &&>(__fn)(
78- static_cast <_Us &&>(__us)..., static_cast <_Self &&>(__self).template __box <_Ts, _Is>::__value...);
92+ static_cast <_Us &&>(__us)...,
93+ static_cast <_Self &&>(__self).STDEXEC_CWG1835_TEMPLATE __box<_Ts, _Is>::__value...);
7994 }
8095
8196 template <class _Fn , class _Self , class ... _Us>
@@ -86,7 +101,8 @@ namespace stdexec {
86101 noexcept ((__nothrow_callable<_Fn, _Us..., __copy_cvref_t <_Self, _Ts>> && ...)) -> void {
87102 return (
88103 static_cast <_Fn &&>(__fn)(
89- static_cast <_Us &&>(__us)..., static_cast <_Self &&>(__self).template __box <_Ts, _Is>::__value),
104+ static_cast <_Us &&>(__us)...,
105+ static_cast <_Self &&>(__self).STDEXEC_CWG1835_TEMPLATE __box<_Ts, _Is>::__value),
90106 ...);
91107 }
92108 };
0 commit comments