[Rpm-maint] [rpm-software-management/rpm] Make macros::expand_numeric return int64_t (PR #3454)

Florian Festi notifications at github.com
Tue Nov 19 14:17:23 UTC 2024


@ffesti commented on this pull request.



>      if (arg == NULL)
 	return 0;
     auto [ ign, val ] = macros().expand_numeric(arg);
-    return val;
+    res = std::clamp(val, (int64_t) INT_MIN, (int64_t) INT_MAX);

No idea why you ask me.
The compiler says

```
/home/ffesti/CVS/rpm/rpmio/macro.cc: In function ‘int rpmExpandNumeric(const char*)’:
/home/ffesti/CVS/rpm/rpmio/macro.cc:2001:21: error: no matching function for call to ‘clamp(std::tuple_element<1, std::pair<int, long int> >::type&, int, int)’
 2001 |     res = std::clamp(val, INT_MIN, INT_MAX);
      |           ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /home/ffesti/CVS/rpm/rpmio/macro.cc:13:
/usr/include/c++/14/bits/stl_algo.h:3623:5: note: candidate: ‘template<class _Tp> constexpr const _Tp& std::clamp(const _Tp&, const _Tp&, const _Tp&)’
 3623 |     clamp(const _Tp& __val, const _Tp& __lo, const _Tp& __hi)
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:3623:5: note:   template argument deduction/substitution failed:
/home/ffesti/CVS/rpm/rpmio/macro.cc:2001:21: note:   deduced conflicting types for parameter ‘const _Tp’ (‘long int’ and ‘int’)
 2001 |     res = std::clamp(val, INT_MIN, INT_MAX);
      |           ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:3643:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr const _Tp& std::clamp(const _Tp&, const _Tp&, const _Tp&, _Compare)’
 3643 |     clamp(const _Tp& __val, const _Tp& __lo, const _Tp& __hi, _Compare __comp)
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:3643:5: note:   candidate expects 4 arguments, 3 provided
make[2]: *** [rpmio/CMakeFiles/librpmio.dir/build.make:132: rpmio/CMakeFiles/librpmio.dir/macro.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:681: rpmio/CMakeFiles/librpmio.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
```
otherwise. What ever that means.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/3454#discussion_r1848447782
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/pull/3454/review/2445611927 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20241119/9232abce/attachment.htm>


More information about the Rpm-maint mailing list