Stiffstream / json_dto

A small header-only library for converting data between json representation and c++ structs
BSD 3-Clause "New" or "Revised" License
149 stars 18 forks source link

Fix undefined behaviour with reinterpret_cast in nullable_t #23

Closed omartijn closed 9 months ago

omartijn commented 9 months ago

Since c++17 it is mandatory launder memory when casting an address to a different type that was constructed there with placement-new. Not doing this is undefined behaviour.

We use the feature-flag defined by the standard library to detect whether it is correctly defined inside the standard library.

eao197 commented 9 months ago

Hi! I'll close it because I believe that the fix (in another form) is in v.0.3.3 release today.