From 87b21e3ded0d7e6677c3639f7e05f2818af72dcf Mon Sep 17 00:00:00 2001 From: Sam James Date: Sat, 10 Aug 2024 16:43:05 +0100 Subject: [PATCH] Fix ODR violation for IsFloatType_v With recent GCC 15 trunk, I started to see: ``` ld: .../kwalletentry.cc.o:(.rodata+0x0): multiple definition of `QtPrivate::IsFloatType_v<_Float16>'; src/runtime/kwalletd/backend/CMakeFiles/KF6WalletBackend.dir/cbc.cc.o:(.rodata+0x0): first defined here ``` The issue is that constexpr is only implicitly inline for functions or static data members [0], so the constexpr IsFloatType_v specialization here causes an ODR violation. Explicitly mark the specialization as inline constexpr. [0] http://eel.is/c++draft/dcl.constexpr#1.sentence-3 Fixes: 4b755bc11a8eadd156c65b7474c11e3ce822c6f1 Pick-to: 6.7 Change-Id: Ie9257138f6d1218ca0a91f5d114aab2483cb275b Reviewed-by: Thiago Macieira (cherry picked from commit a06f3e823bea0361125a10dd361f6fd50a4041cc) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/global/qcomparehelpers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/global/qcomparehelpers.h b/src/corelib/global/qcomparehelpers.h index 1c727a8f37f..8bf78d766bc 100644 --- a/src/corelib/global/qcomparehelpers.h +++ b/src/corelib/global/qcomparehelpers.h @@ -565,7 +565,7 @@ constexpr bool IsFloatType_v = std::is_floating_point_v; #if QFLOAT16_IS_NATIVE template <> -constexpr bool IsFloatType_v = true; +inline constexpr bool IsFloatType_v = true; #endif } // namespace QtPrivate