diff --git a/src/Magnum/Image.h b/src/Magnum/Image.h index 4bbbfdbe0..a725c83ed 100644 --- a/src/Magnum/Image.h +++ b/src/Magnum/Image.h @@ -72,6 +72,11 @@ template class Image { * instead. */ explicit CORRADE_DEPRECATED("use Image(PixelFormat, PixelType, const VectorTypeFor&, Containers::Array&&) instead") Image(PixelFormat format, PixelType type, const VectorTypeFor& size, void* data) noexcept: Image{{}, format, type, size, Containers::Array{reinterpret_cast(data), Implementation::imageDataSizeFor(format, type, size)}} {} + #ifndef DOXYGEN_GENERATING_OUTPUT + /* To avoid decay of nullptr to const void* and unwanted use of + deprecated function */ + explicit Image(PixelFormat format, PixelType type, const VectorTypeFor& size, std::nullptr_t) noexcept: Image{{}, format, type, size, nullptr} {} + #endif #endif /** diff --git a/src/Magnum/Trade/ImageData.h b/src/Magnum/Trade/ImageData.h index fc38a63bc..33b1d3dd7 100644 --- a/src/Magnum/Trade/ImageData.h +++ b/src/Magnum/Trade/ImageData.h @@ -80,6 +80,11 @@ template class ImageData { * @deprecated Use @ref ImageData(PixelFormat, PixelType, const VectorTypeFor&, Containers::Array&&, const void*) instead. */ explicit CORRADE_DEPRECATED("use ImageData(PixelFormat, PixelType, const VectorTypeFor&, Containers::Array&&) instead") ImageData(PixelFormat format, PixelType type, const VectorTypeFor& size, void* data) noexcept: ImageData{format, type, size, Containers::Array{reinterpret_cast(data), Magnum::Implementation::imageDataSizeFor(format, type, size)}} {} + #ifndef DOXYGEN_GENERATING_OUTPUT + /* To avoid decay of nullptr to const void* and unwanted use of + deprecated function */ + explicit ImageData(PixelFormat format, PixelType type, const VectorTypeFor& size, std::nullptr_t) noexcept: ImageData{{}, format, type, size, nullptr} {} + #endif #endif #ifndef MAGNUM_TARGET_GLES