[Development] static constexpr in exported classes needs out-of-line definitions

Thiago Macieira thiago.macieira at intel.com
Fri Jan 19 02:06:17 CET 2024


On Wednesday, 17 January 2024 19:35:17 PST Thiago Macieira wrote:
> Alternatives:
> * move to a class that is not exported
>    trick: add an empty base with the variable
> * change to enum (if primitive)

* change to an static (inline) constexpr function

Then there's always a copy, because GCC either inlines or emits a copy for 
functions.
https://mingw.godbolt.org/z/bh95q8PKf

MSVC sucks at inlining dllimported functions, but there's no problem because 
it exported on the other side.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Cloud Software Architect - Intel DCAI Cloud Engineering
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5163 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20240118/d7409eb4/attachment.bin>


More information about the Development mailing list