RFR: 8357579: Compilation error: first argument in call to 'memset' is a pointer to non-trivially copyable type [v13]
Kim Barrett
kbarrett at openjdk.org
Tue Nov 11 06:43:07 UTC 2025
On Mon, 10 Nov 2025 07:24:50 GMT, Jan Kratochvil <jkratochvil at openjdk.org> wrote:
>> With clang-20 using --with-toolchain-type=clang resolveFieldEntry.cpp and resolveMethodEntry.cpp break the build with similar warnings like:
>>
>> src/hotspot/share/oops/resolvedFieldEntry.cpp:49:10: error: first argument in call to 'memset' is a pointer to non-trivially copyable type 'ResolvedFieldEntry' [-Werror,-Wnontrivial-memcall]
>> 49 | memset(this, 0, sizeof(*this));
>> | ^
>> src/hotspot/share/oops/resolvedFieldEntry.cpp:49:10: note: explicitly cast the pointer to silence this warning
>> 49 | memset(this, 0, sizeof(*this));
>> | ^
>> | (void*)
>>
>> The patch follows the suggested fix.
>
> Jan Kratochvil has updated the pull request incrementally with one additional commit since the last revision:
>
> Add Ioi Lam's comment
src/hotspot/share/oops/resolvedFieldEntry.cpp line 29:
> 27: #include "oops/resolvedFieldEntry.hpp"
> 28:
> 29: STATIC_ASSERT(std::is_trivially_copyable_v<ResolvedFieldEntry> == true);
Style nit: `STATIC_ASSERT` shouldn't be used anymore. C++17 gives us 1-arg `static_assert`.
Also, explicit comparison to `true` is weird.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26098#discussion_r2513009462
More information about the hotspot-dev
mailing list