Skip to content

Commit 504107d

Browse files
authored
Merge pull request #2927 from stan-dev/fix/promote-scalar-ambiguous-tuples
Fix: promote_scalar ambiguous tuple overload
2 parents 304f929 + b998a53 commit 504107d

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

stan/math/prim/fun/promote_scalar.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,11 @@ inline auto promote_scalar(UnPromotedType&& x) {
5959

6060
// Forward decl for iterating over tuples used in std::vector<tuple>
6161
template <typename PromotionScalars, typename UnPromotedTypes,
62-
require_all_tuple_t<PromotionScalars, UnPromotedTypes>* = nullptr>
62+
require_all_tuple_t<PromotionScalars, UnPromotedTypes>* = nullptr,
63+
require_not_same_t<PromotionScalars, UnPromotedTypes>* = nullptr>
6364
inline constexpr promote_scalar_t<PromotionScalars, UnPromotedTypes>
6465
promote_scalar(UnPromotedTypes&& x);
66+
6567
/**
6668
* Promote the scalar type of an standard vector to the requested type.
6769
*
@@ -93,7 +95,8 @@ inline auto promote_scalar(UnPromotedType&& x) {
9395
* @param x input
9496
*/
9597
template <typename PromotionScalars, typename UnPromotedTypes,
96-
require_all_tuple_t<PromotionScalars, UnPromotedTypes>*>
98+
require_all_tuple_t<PromotionScalars, UnPromotedTypes>*,
99+
require_not_same_t<PromotionScalars, UnPromotedTypes>*>
97100
inline constexpr promote_scalar_t<PromotionScalars, UnPromotedTypes>
98101
promote_scalar(UnPromotedTypes&& x) {
99102
return index_apply<std::tuple_size<std::decay_t<UnPromotedTypes>>::value>(

0 commit comments

Comments
 (0)