Skip to content

KisZug: fix ODR violation for map_*

Sam James requested to merge thesamesam/krita:gcc15-odr into master

With recent GCC 15 trunk, I started to see:

ld:: .../kis_brush_selection_widget.cpp.o (symbol from plugin): in function `PrecisionModel::metaObject() const':
	(.text+0x0): multiple definition of `kiszug::map_less_equal<double>
		; plugins/paintops/libpaintop/CMakeFiles/kritalibpaintop.dir/KisPredefinedBrushModel.cpp.o (symbol from plugin):(.text+0x0): first defined here
[...]

The issue is that constexpr is only implicitly inline for functions or static data members [0], so the constexpr map_equal specialization (and so on) causes an ODR violation.

Explicitly mark the specializations as inline constexpr.

[0] http://eel.is/c++draft/dcl.constexpr#1.sentence-3

See also https://codereview.qt-project.org/c/qt/qtbase/+/582403.

Merge request reports

Loading