Elektrine lite

← Feed

@DanielaKEngert@hachyderm.io

Post #2636432

2026-04-07 11:21 UTC

@manx@mastodon.online @andreasfertig@mas.to The std::start_lifetime_as*() functions have constraints that e.g. reinterpret_cast<>() doesn't have: * type constraints: https://eel.is/c++draft/mem#obj.lifetime-1 * position constraints: https://eel.is/c++draft/mem#obj.lifetime-2 The latter is a precondition that could be strengthened and (partially) unconditionally checked for in a *hardened standard library implementation*. The former removes affected overloads when the constraints are not satisfied.

Replies (1)

  • @manx@mastodon.online 2026-04-07 11:37

    @DanielaKEngert@hachyderm.io @andreasfertig@mas.to Honestly, it does not really matter in this case whether it is straight language Undefined Behaviour, or whether it optionally can trigger an assertion in some stdlib implementations. Both are bugs, and it should not be used or taught this way.

    Open ##2636433