You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
static_assert(CMSG_SPACE(sizeof(*pkt)) <= sizeof(*cmsgbuf), "Buffer is too small for in6_pktinfo");
expands to this on macOS:
static_assert((((__darwin_size_t)((char *)(__darwin_size_t)(sizeof(structcmsghdr)) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1)) + ((__darwin_size_t)((char *)(__darwin_size_t)(sizeof(*pkt)) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1))) <= sizeof(*cmsgbuf), "Buffer is too small for in6_pktinfo");
This apparently used to compile, but no longer does. Maybe clang got stricter about what it allows inside a constexpr. I've done a quick check if the involved header files have changed, but apparently not.
Compile failure:
misc.cc:893:19: error: static_assert expression is not an integral constant expression
static_assert(CMSG_SPACE(sizeof(*pkt)) <= sizeof(*cmsgbuf), "Buffer is too small for in6_pktinfo");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/socket.h:652:33: note: expanded from macro 'CMSG_SPACE'
#define CMSG_SPACE(l) (__DARWIN_ALIGN32(sizeof(struct cmsghdr)) + __DARWIN_ALIGN32(l))
^
misc.cc:893:19: note: cast that performs the conversions of a reinterpret_cast is not allowed in a constant expression
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/socket.h:652:34: note: expanded from macro 'CMSG_SPACE'
#define CMSG_SPACE(l) (__DARWIN_ALIGN32(sizeof(struct cmsghdr)) + __DARWIN_ALIGN32(l))
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/i386/_param.h:43:42: note: expanded from macro '__DARWIN_ALIGN32'
#define __DARWIN_ALIGN32(p) ((__darwin_size_t)((char *)(__darwin_size_t)(p) + __DARWIN_ALIGNBYTES32) &~ __DARWIN_ALIGNBYTES32)
^
misc.cc:912:19: error: static_assert expression is not an integral constant expression
static_assert(CMSG_SPACE(sizeof(*pkt)) <= sizeof(*cmsgbuf), "Buffer is too small for in_pktinfo");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/socket.h:652:33: note: expanded from macro 'CMSG_SPACE'
#define CMSG_SPACE(l) (__DARWIN_ALIGN32(sizeof(struct cmsghdr)) + __DARWIN_ALIGN32(l))
^
misc.cc:912:19: note: cast that performs the conversions of a reinterpret_cast is not allowed in a constant expression
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/socket.h:652:34: note: expanded from macro 'CMSG_SPACE'
#define CMSG_SPACE(l) (__DARWIN_ALIGN32(sizeof(struct cmsghdr)) + __DARWIN_ALIGN32(l))
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/i386/_param.h:43:42: note: expanded from macro '__DARWIN_ALIGN32'
#define __DARWIN_ALIGN32(p) ((__darwin_size_t)((char *)(__darwin_size_t)(p) + __DARWIN_ALIGNBYTES32) &~ __DARWIN_ALIGNBYTES32)
^
2 errors generated.
Buried in these errors is this note: cast that performs the conversions of a reinterpret_cast is not allowed in a constant expression
Short description
this line in misc.cc ...
expands to this on macOS:
This apparently used to compile, but no longer does. Maybe clang got stricter about what it allows inside a constexpr. I've done a quick check if the involved header files have changed, but apparently not.
Compile failure:
Buried in these errors is this note: cast that performs the conversions of a reinterpret_cast is not allowed in a constant expression
Some info on constexpr / reinterpret_cast:
https://stackoverflow.com/questions/26200827/getting-around-the-reinterpret-cast-limitation-with-constexpr
Environment
clang version:
The text was updated successfully, but these errors were encountered: