Re: cxxtools-2.2.1 fails to compile on rawhide with gcc11 with /usr/include/c++/11/string_view:98:21: error: static assertion failed

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

 



On 31/01/21 10:00 -0000, Martin Gansser wrote:
The issue has now been resolved with this patch:

+++ include/cxxtools/char.h	2021-01-30 18:28:23.877390000 +0100
@@ -68,9 +68,7 @@
            typedef int32_t value_type;

            //! Constructs a character with a value of 0.
-            Char()
-            : _value(0)
-            {}
+            Char() = default;

            //! Constructs a character using the given char as base for the character value.
            Char(char ch)
@@ -114,9 +112,6 @@
                return Char(0);
            }

-            Char& operator=(const Char& ch)
-            { _value = ch._value; return *this; }
-

Ah, I was looking at the upstream code which has already removed that.

            /**
             * @brief Returns the internal value (unsigned 32 bits) of this character.
             * @return The 32-bit-value of this character.
@@ -336,14 +331,14 @@
    inline char_traits<cxxtools::Char>::char_type*
    char_traits<cxxtools::Char>::move(char_type* s1, const char_type* s2, int_type n)
    {
-        return (cxxtools::Char*)std::memmove(s1, s2, n * sizeof(cxxtools::Char));
+        return static_cast<cxxtools::Char*>(std::memmove(static_cast<void*>(s1), static_cast<const void*>(s2), n * sizeof(cxxtools::Char)));	
    }


    inline char_traits<cxxtools::Char>::char_type*
    char_traits<cxxtools::Char>::copy(char_type* s1, const char_type* s2, size_t n)
    {
-        return (cxxtools::Char*)std::memcpy(s1, s2, n * sizeof(cxxtools::Char));
+        return static_cast<cxxtools::Char*>(std::memcpy(static_cast<void*>(s1), static_cast<const void*>(s2), n * sizeof(cxxtools::Char)));

These changes seem unnecessary, and would only hide bugs.

After removing the non-trivial operator= there should be no more
warning about using memmove and memcpy on Char objects.


_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux