Re: [libgpiod] Fix for non-const bitset_cmp operator ()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



śr., 28 lis 2018 o 01:35 Michael Beach <michaelb@xxxxxxxx> napisał(a):
>
> Hi all, when trying to build libgpiod with clang 6.0 and libc++ I was
> running into a problem with bitset_cmp in line_bulk.cpp. Clang was
> complaining that the operator () defined by bitset_cmp was non-const.
> Although some readings of the C++ standard allow this, it was a bit of
> a grey area and generally considered to be undesirable, and has since
> been fixed in C++17 (it is now required to be const) -- see
> https://cplusplus.github.io/LWG/issue2542.
> The following patch resolves the problem...
>
> diff --git a/bindings/cxx/line_bulk.cpp b/bindings/cxx/line_bulk.cpp
> index c93f364..e52d33d 100644
> --- a/bindings/cxx/line_bulk.cpp
> +++ b/bindings/cxx/line_bulk.cpp
> @@ -29,7 +29,7 @@ const ::std::map<int, int> reqtype_mapping = {
>
>  struct bitset_cmp
>  {
> -       bool operator()(const ::std::bitset<32>& lhs, const
> ::std::bitset<32>& rhs)
> +       bool operator()(const ::std::bitset<32>& lhs, const
> ::std::bitset<32>& rhs) const
>         {
>                 return lhs.to_ulong() < rhs.to_ulong();
>         }

Hi Michael,

please resend this with [PATCH][libgpiod] tags. I use patchwork and it
didn't pick this one up.

Bart




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux