C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Replace an object -- but retain old object if new object fails to construct

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Wed, 29 Oct 2025 13:09:34 +0000
On Wednesday, October 29, 2025, Giuseppe D'Angelo wrote:
>
>
> Why would they crash? This again has been extensively discussed; the
> Standard says that you can trivially relocate trivially relocatable
> polymorphic types, and people working on the arm64e ABI have confirmed that
> this is perfectly acceptable and implementable.
>



Oliver works at Apple and he worked on the arm64e compiler, and here's what
he said an hour or two ago in this thread:

"For the topic at hand clang currently does not support trivial relocation
of polymorphic types - and reports correctly that such are not."

Basically he's saying that the following assertion will always succeed:

    static_assert( false == (is_polymorphic_v<T> &&
is_trivially_relocatable_v<T>) );

On an arm64e computer, if you relocate a polymorphic object, and then
invoke a virtual method, the attempt to access the vtable will cause a CPU
trap because the vtable pointer will be incorrectly encrypted.

(Not sure if it will be a "CPU trap" but it will crash in some way)

Received on 2025-10-29 13:09:36