This is an automated email from the ASF dual-hosted git repository.

bneradt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver-libswoc.git

commit 385dc6b4922821399e28a881d6c1c215c3ff0086
Author: Mo Chen <[email protected]>
AuthorDate: Tue Apr 22 13:19:44 2025 -0500

    Fix build for clang 20 (#12202)
    
    Fix these warnings:
    
    code/src/swoc_ip.cc:242:10: error: first argument in call to 'memset' is a 
pointer to non-trivially copyable type 'swoc::IPEndpoint' 
[-Werror,-Wnontrivial-memaccess]
      242 |   memset(this, 0, sizeof(*this));
          |          ^
---
 code/src/swoc_ip.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/code/src/swoc_ip.cc b/code/src/swoc_ip.cc
index 6403922..6f6ae13 100644
--- a/code/src/swoc_ip.cc
+++ b/code/src/swoc_ip.cc
@@ -239,7 +239,7 @@ IPEndpoint::family_name(sa_family_t family) {
 
 IPEndpoint &
 IPEndpoint::set_to_any(int family) {
-  memset(this, 0, sizeof(*this));
+  memset(static_cast<void *>(this), 0, sizeof(*this));
   if (AF_INET == family) {
     sa4.sin_family      = family;
     sa4.sin_addr.s_addr = INADDR_ANY;
@@ -268,7 +268,7 @@ IPEndpoint::is_any() const {
 
 IPEndpoint &
 IPEndpoint::set_to_loopback(int family) {
-  memset(this, 0, sizeof(*this));
+  memset(static_cast<void *>(this), 0, sizeof(*this));
   if (AF_INET == family) {
     sa.sa_family        = family;
     sa4.sin_addr.s_addr = htonl(INADDR_LOOPBACK);

Reply via email to