refine nvcc protobuf patch name, add a patch for abseil
[gentoo-patches.git] / nvcc-13.3-abseil-templates-fix.patch
1 From 08ce1c212436916bb34d3c3fb8d1cbe2d6c48dc9 Mon Sep 17 00:00:00 2001
2 From: Tianlei Wu <tlwu@microsoft.com>
3 Date: Sat, 13 Jun 2026 23:47:08 +0000
4 Subject: [PATCH 1/3] fix linux build for cuda 13.3
5
6 ---
7 btree_container.h | 8 ++++----
8 common.h | 10 ++++++++++
9 raw_hash_map.h | 4 ++--
10 3 files changed, 16 insertions(+), 6 deletions(-)
11
12 --- a/absl/container/internal/common.h
13 +++ b/absl/container/internal/common.h
14 @@ -68,6 +68,16 @@
15 using AddPtr = Other*;
16 };
17
18 +// Workaround for an NVCC 13.3 (cudafe++) host parse error triggered by naming
19 +// the member alias template `IfRRef<...>::AddPtr<Other>` directly inside the
20 +// insert_or_assign/try_emplace macros. Wrapping the qualified-id in this
21 +// top-level alias template avoids the mis-parse while preserving the original
22 +// SFINAE behavior: substitution still happens in the immediate context, so
23 +// forming a pointer-to-reference remains a soft (SFINAE) failure rather than a
24 +// hard error. See https://github.com/abseil/abseil-cpp/issues/2075.
25 +template <class T, class Other>
26 +using IfRRefAddPtr = typename IfRRef<T>::template AddPtr<Other>;
27 +
28 template <class, class = void>
29 struct IsTransparent : std::false_type {};
30 template <class T>
31 --- a/absl/container/internal/raw_hash_map.h
32 +++ b/absl/container/internal/raw_hash_map.h
33 @@ -106,8 +106,8 @@
34 typename K = key_type, class V = mapped_type, \
35 ABSL_INTERNAL_IF_##KValue##_NOR_##VValue( \
36 int = (EnableIf<LifetimeBoundKV<K, KValue, V, VValue, \
37 - IfRRef<int KQual>::AddPtr<K>, \
38 - IfRRef<int VQual>::AddPtr<V>>>()), \
39 + IfRRefAddPtr<int KQual, K>, \
40 + IfRRefAddPtr<int VQual, V>>>()), \
41 ABSL_INTERNAL_SINGLE_ARG( \
42 int &..., \
43 decltype(EnableIf<LifetimeBoundKV<K, KValue, V, VValue>>()) = \
44 --- a/absl/container/internal/btree_container.h
45 +++ b/absl/container/internal/btree_container.h
46 @@ -497,8 +497,8 @@
47 typename K = key_type, class M, \
48 ABSL_INTERNAL_IF_##KValue##_NOR_##MValue( \
49 int = (EnableIf<LifetimeBoundKV<K, KValue, M, MValue, \
50 - IfRRef<int KQual>::AddPtr<K>, \
51 - IfRRef<int MQual>::AddPtr<M>>>()), \
52 + IfRRefAddPtr<int KQual, K>, \
53 + IfRRefAddPtr<int MQual, M>>>()), \
54 ABSL_INTERNAL_SINGLE_ARG( \
55 int &..., \
56 decltype(EnableIf<LifetimeBoundKV<K, KValue, M, MValue>>()) = \
57 @@ -598,10 +598,10 @@
58 ABSL_INTERNAL_IF_##KValue( \
59 class... Args, \
60 int = (EnableIf< \
61 - LifetimeBoundK<K, KValue, IfRRef<int KQual>::AddPtr<K>>>())), \
62 + LifetimeBoundK<K, KValue, IfRRefAddPtr<int KQual, K>>>())), \
63 ABSL_INTERNAL_IF_##KValue( \
64 decltype(EnableIf<LifetimeBoundK< \
65 - K, KValue, IfRRef<int KQual>::AddPtr<K>>>()) = 0, \
66 + K, KValue, IfRRefAddPtr<int KQual, K>>>()) = 0, \
67 class... Args), \
68 std::enable_if_t<!std::is_convertible<K, const_iterator>::value, int> = \
69 0> \