Browse Source

GL: work around a warning in C++20 mode.

New since 7ca7e5a62b, 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.
pull/653/head
Vladimír Vondruš 2 years ago
parent
commit
06b667f275
  1. 7
      src/Magnum/GL/Attribute.h

7
src/Magnum/GL/Attribute.h

@ -314,7 +314,12 @@ template<UnsignedInt location, class T> 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<T>::DefaultComponents, Implementation::Attribute<T>::DefaultComponentCount*Implementation::Attribute<T>::DefaultDataTypeSize, Implementation::Attribute<T>::DefaultDataType, dataOptions} {}
constexpr Attribute(DataOptions dataOptions = DataOptions()): Attribute{
Implementation::Attribute<T>::DefaultComponents,
/* Cast one enum to avoid -Wdeprecated-anon-enum-conversion when
compiling as C++20 */
Implementation::Attribute<T>::DefaultComponentCount*UnsignedInt(Implementation::Attribute<T>::DefaultDataTypeSize),
Implementation::Attribute<T>::DefaultDataType, dataOptions} {}
/**
* @brief Constructor

Loading…
Cancel
Save