From 06b667f2757f0c57913b6dbe8218c7497f3c321b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 4 Nov 2024 11:36:51 +0100 Subject: [PATCH] GL: work around a warning in C++20 mode. New since 7ca7e5a62b6556e553dc8fefaf9fbb2c3d5e8dfe, and no, I'm not going to switch from enums to some static constexpr int. Unless this changed in recent standards, it still means one can take an address of it. Which shouldn't be possible for a constant as that could unnecessarily pessimize its perf. --- src/Magnum/GL/Attribute.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Magnum/GL/Attribute.h b/src/Magnum/GL/Attribute.h index 7850f2110..ee1c3e683 100644 --- a/src/Magnum/GL/Attribute.h +++ b/src/Magnum/GL/Attribute.h @@ -314,7 +314,12 @@ template class Attribute { * count is set to the same value as in type used in shader (e.g. * @ref Components::Three for @ref Magnum::Vector3 "Vector3"). */ - constexpr Attribute(DataOptions dataOptions = DataOptions()): Attribute{Implementation::Attribute::DefaultComponents, Implementation::Attribute::DefaultComponentCount*Implementation::Attribute::DefaultDataTypeSize, Implementation::Attribute::DefaultDataType, dataOptions} {} + constexpr Attribute(DataOptions dataOptions = DataOptions()): Attribute{ + Implementation::Attribute::DefaultComponents, + /* Cast one enum to avoid -Wdeprecated-anon-enum-conversion when + compiling as C++20 */ + Implementation::Attribute::DefaultComponentCount*UnsignedInt(Implementation::Attribute::DefaultDataTypeSize), + Implementation::Attribute::DefaultDataType, dataOptions} {} /** * @brief Constructor