From 3ac259f4cc94efa0888ea04861d686a20b617fef Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 25 Mar 2024 21:42:36 +0100 Subject: [PATCH] QTypeInfo: add some code comments regarding a redundant check Change-Id: Ic92f44c8df63bd71f313b672125481d710dc8c66 Reviewed-by: Thiago Macieira --- src/corelib/global/qtypeinfo.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h index 3ddb4728c0..255a2b33c6 100644 --- a/src/corelib/global/qtypeinfo.h +++ b/src/corelib/global/qtypeinfo.h @@ -23,6 +23,13 @@ class QDebug; namespace QtPrivate { +// A trivially copyable class must also have a trivial, non-deleted +// destructor [class.prop/1.3], CWG1734. Some implementations don't +// check for a trivial destructor, because of backwards compatibility +// with C++98's definition of trivial copyability. +// Since trivial copiability has implications for the ABI, implementations +// can't "just fix" their traits. So, although formally redundant, we +// explicitly check for trivial destruction here. template inline constexpr bool qIsRelocatable = std::is_trivially_copyable_v && std::is_trivially_destructible_v;