Issue 1:
System information (version)

OpenCV => 4.5.5

Operating System / Platform => Ubuntu 21.10

Compiler => gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0

Detailed description

When compiling OpenCV 4.5.5 header files into a program that's been compiled with C++20 (using gcc 11.2.0) we get flooded with warnings stating -Wdeprecated-enum-enum-conversion; e.g.

/usr/local/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_OutputArray::_OutputArray(std::array<cv::Mat, _Nm>&)’:
/usr/local/include/opencv4/opencv2/core/mat.inl.hpp:217:22: warning: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Wdeprecated-enum-enum-conversion]
217 | { init(STD_ARRAY_MAT + ACCESS_WRITE, arr.data(), Size(1, _Nm)); }
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~

or

/usr/local/include/opencv4/opencv2/videoio.hpp:309:80: warning: arithmetic between different enumeration types ‘cv::<unnamed enum>’ and ‘cv::<unnamed enum>’ is deprecated [-Wdeprecated-enum-enum-conversion]
309 | CAP_OPENNI_DEPTH_GENERATOR_BASELINE = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_BASELINE,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~

or

/usr/local/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputOutputArray::_InputOutputArray(cv::cuda::GpuMat&)’:
/usr/local/include/opencv4/opencv2/core/mat.inl.hpp:398:21: warning: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Wdeprecated-enum-enum-conversion]
398 | { init(CUDA_GPU_MAT + ACCESS_RW, &d_mat); }
| ~~~~~~~~~~~~~^~~~~~~~~~~

etc

I've looked for Wdeprecated-enum-enum-conversion on GitHub (issues, etc), found this StackOverflow question, and searched the git log of master (for enum since the 4.5.5 release) but can't see any evidence for it being resolved. The only thing I have not done yet (that I'm aware might be helpful) is build from current master to compare.

Steps to reproduce

Compile OpenCV as per documentation

Use header files I've named above in your compilation

Issue submission checklist

I report the issue, it's not a question

I checked the problem with documentation, FAQ, open issues,

forum.opencv.org, Stack Overflow, etc and have not found any solution

I updated to the latest OpenCV version and the issue is still there

There is reproducer code and related data files: videos, images, onnx, etc

Issue 2:
System information (version)

OpenCV => 4.5.1+dfsg-4

OS => Debian Sid/Experimental

Compiler => g++-11 (Debian 11.1.0-3) 11.1.0

Detailed description

When I upgraded my compiler to g++-11, just to see if some bug in gcc was already fixed, I found out a new one. It started reporting an error from a system header, which may be even another bug in g++-11, but still, you might want to fix it in OpenCV anyway, so I'll report it here.

-	CXX	$builddir/cv/alx/compare.cxx.s
In file included from /usr/include/opencv4/opencv2/core/mat.hpp:3723,
from /usr/include/opencv4/opencv2/core.hpp:59,
from /home/user/src/alx/libalx/src/cv/alx/compare.cxx:16:
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputArray::_InputArray(const cv::Mat&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:103:57: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
103 | inline _InputArray::_InputArray(const Mat& m) { init(MAT+ACCESS_READ, &m); }
| ~~~^~~~~~~~~~~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputArray::_InputArray(const std::vector<cv::Mat>&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:104:83: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
104 | nputArray::_InputArray(const std::vector<Mat>& vec) { init(STD_VECTOR_MAT+ACCESS_READ, &vec); }
| ~~~~~~~~~~~~~~^~~~~~~~~~~~

/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputArray::_InputArray(const cv::UMat&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:105:59: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
105 | inline _InputArray::_InputArray(const UMat& m) { init(UMAT+ACCESS_READ, &m); }
| ~~~~^~~~~~~~~~~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputArray::_InputArray(const std::vector<cv::UMat>&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:106:85: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
106 | utArray::_InputArray(const std::vector<UMat>& vec) { init(STD_VECTOR_UMAT+ACCESS_READ, &vec); }
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~

/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputArray::_InputArray(const std::array<cv::Mat, _Nm>&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:118:22: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
118 | { init(STD_ARRAY_MAT + ACCESS_READ, arr.data(), Size(1, _Nm)); }
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputArray::_InputArray(const cv::cuda::GpuMat&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:148:21: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
148 | { init(CUDA_GPU_MAT + ACCESS_READ, &d_mat); }
| ~~~~~~~~~~~~~^~~~~~~~~~~~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputArray::_InputArray(const std::vector<cv::cuda::GpuMat>&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:151:38: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
151 | { init(STD_VECTOR_CUDA_GPU_MAT + ACCESS_READ, &d_mat);}
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputArray::_InputArray(const cv::ogl::Buffer&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:154:22: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
154 | { init(OPENGL_BUFFER + ACCESS_READ, &buf); }
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputArray::_InputArray(const cv::cuda::HostMem&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:157:22: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
157 | { init(CUDA_HOST_MEM + ACCESS_READ, &cuda_mem); }
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_OutputArray::_OutputArray()’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:200:49: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
200 | inline _OutputArray::_OutputArray() { init(NONE + ACCESS_WRITE, 0); }
| ~~~~~^~~~~~~~~~~~~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_OutputArray::_OutputArray(cv::Mat&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:202:53: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
202 | inline _OutputArray::_OutputArray(Mat& m) { init(MAT+ACCESS_WRITE, &m); }
| ~~~^~~~~~~~~~~~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_OutputArray::_OutputArray(std::vector<cv::Mat>&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:203:80: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
203 | _OutputArray::_OutputArray(std::vector<Mat>& vec) { init(STD_VECTOR_MAT + ACCESS_WRITE, &vec); }
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~

/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_OutputArray::_OutputArray(cv::UMat&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:204:56: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
204 | inline _OutputArray::_OutputArray(UMat& m) { init(UMAT + ACCESS_WRITE, &m); }
| ~~~~~^~~~~~~~~~~~~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_OutputArray::_OutputArray(std::vector<cv::UMat>&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:205:82: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
205 | OutputArray::_OutputArray(std::vector<UMat>& vec) { init(STD_VECTOR_UMAT + ACCESS_WRITE, &vec); }
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~

/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_OutputArray::_OutputArray(std::array<cv::Mat, _Nm>&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:217:22: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
217 | { init(STD_ARRAY_MAT + ACCESS_WRITE, arr.data(), Size(1, _Nm)); }
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_OutputArray::_OutputArray(cv::cuda::GpuMat&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:272:21: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
272 | { init(CUDA_GPU_MAT + ACCESS_WRITE, &d_mat); }
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_OutputArray::_OutputArray(std::vector<cv::cuda::GpuMat>&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:275:38: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
275 | { init(STD_VECTOR_CUDA_GPU_MAT + ACCESS_WRITE, &d_mat);}
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_OutputArray::_OutputArray(cv::ogl::Buffer&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:278:22: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
278 | { init(OPENGL_BUFFER + ACCESS_WRITE, &buf); }
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_OutputArray::_OutputArray(cv::cuda::HostMem&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:281:22: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
281 | { init(CUDA_HOST_MEM + ACCESS_WRITE, &cuda_mem); }
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputOutputArray::_InputOutputArray(cv::Mat&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:328:63: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
328 | inline _InputOutputArray::_InputOutputArray(Mat& m) { init(MAT+ACCESS_RW, &m); }
| ~~~^~~~~~~~~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputOutputArray::_InputOutputArray(std::vector<cv::Mat>&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:329:89: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
329 | tputArray::_InputOutputArray(std::vector<Mat>& vec) { init(STD_VECTOR_MAT+ACCESS_RW, &vec); }
| ~~~~~~~~~~~~~~^~~~~~~~~~

/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputOutputArray::_InputOutputArray(cv::UMat&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:330:65: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
330 | inline _InputOutputArray::_InputOutputArray(UMat& m) { init(UMAT+ACCESS_RW, &m); }
| ~~~~^~~~~~~~~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputOutputArray::_InputOutputArray(std::vector<cv::UMat>&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:331:91: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
331 | utArray::_InputOutputArray(std::vector<UMat>& vec) { init(STD_VECTOR_UMAT+ACCESS_RW, &vec); }
| ~~~~~~~~~~~~~~~^~~~~~~~~~

/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputOutputArray::_InputOutputArray(std::array<cv::Mat, _Nm>&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:343:22: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
343 | { init(STD_ARRAY_MAT + ACCESS_RW, arr.data(), Size(1, _Nm)); }
| ~~~~~~~~~~~~~~^~~~~~~~~~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputOutputArray::_InputOutputArray(cv::cuda::GpuMat&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:398:21: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
398 | { init(CUDA_GPU_MAT + ACCESS_RW, &d_mat); }
| ~~~~~~~~~~~~~^~~~~~~~~~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputOutputArray::_InputOutputArray(cv::ogl::Buffer&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:401:22: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
401 | { init(OPENGL_BUFFER + ACCESS_RW, &buf); }
| ~~~~~~~~~~~~~~^~~~~~~~~~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputOutputArray::_InputOutputArray(cv::cuda::HostMem&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:404:22: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
404 | { init(CUDA_HOST_MEM + ACCESS_RW, &cuda_mem); }
| ~~~~~~~~~~~~~~^~~~~~~~~~~
In file included from /usr/include/opencv4/opencv2/highgui.hpp:51,
from /home/user/src/alx/libalx/src/cv/alx/compare.cxx:27:
/usr/include/opencv4/opencv2/videoio.hpp: At global scope:
/usr/include/opencv4/opencv2/videoio.hpp:254:80: error: arithmetic between different enumeration types ‘cv::<unnamed enum>’ and ‘cv::<unnamed enum>’ is deprecated [-Werror=deprecated-enum-enum-conversion]
254 | CAP_OPENNI_IMAGE_GENERATOR_PRESENT = CAP_OPENNI_IMAGE_GENERATOR + CAP_PROP_OPENNI_GENERATOR_PRESENT,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/usr/include/opencv4/opencv2/videoio.hpp:255:80: error: arithmetic between different enumeration types ‘cv::<unnamed enum>’ and ‘cv::<unnamed enum>’ is deprecated [-Werror=deprecated-enum-enum-conversion]
255 | CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE = CAP_OPENNI_IMAGE_GENERATOR + CAP_PROP_OPENNI_OUTPUT_MODE,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/usr/include/opencv4/opencv2/videoio.hpp:256:80: error: arithmetic between different enumeration types ‘cv::<unnamed enum>’ and ‘cv::<unnamed enum>’ is deprecated [-Werror=deprecated-enum-enum-conversion]
256 | CAP_OPENNI_DEPTH_GENERATOR_PRESENT = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_GENERATOR_PRESENT,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/usr/include/opencv4/opencv2/videoio.hpp:257:80: error: arithmetic between different enumeration types ‘cv::<unnamed enum>’ and ‘cv::<unnamed enum>’ is deprecated [-Werror=deprecated-enum-enum-conversion]
257 | CAP_OPENNI_DEPTH_GENERATOR_BASELINE = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_BASELINE,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~

/usr/include/opencv4/opencv2/videoio.hpp:258:80: error: arithmetic between different enumeration types ‘cv::<unnamed enum>’ and ‘cv::<unnamed enum>’ is deprecated [-Werror=deprecated-enum-enum-conversion]
258 | CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_FOCAL_LENGTH,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/usr/include/opencv4/opencv2/videoio.hpp:259:80: error: arithmetic between different enumeration types ‘cv::<unnamed enum>’ and ‘cv::<unnamed enum>’ is deprecated [-Werror=deprecated-enum-enum-conversion]
259 | CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_REGISTRATION,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/usr/include/opencv4/opencv2/videoio.hpp:261:77: error: arithmetic between different enumeration types ‘cv::<unnamed enum>’ and ‘cv::<unnamed enum>’ is deprecated [-Werror=deprecated-enum-enum-conversion]
261 | CAP_OPENNI_IR_GENERATOR_PRESENT = CAP_OPENNI_IR_GENERATOR + CAP_PROP_OPENNI_GENERATOR_PRESENT,
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In file included from /usr/include/opencv4/opencv2/core/mat.hpp:3723,
from /usr/include/opencv4/opencv2/core.hpp:59,
from /home/user/src/alx/libalx/src/cv/alx/compare.cxx:16:
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In instantiation of ‘cv::Mat::Mat(const cv::Matx<_Tp, m, n>&, bool) [with _Tp = double; int m = 2; int n = 3]’:
/usr/include/opencv4/opencv2/imgproc.hpp:2445:64: required from here
/usr/include/opencv4/opencv2/core/mat.inl.hpp:533:23: error: arithmetic between different enumeration types ‘cv::Mat::<unnamed enum>’ and ‘cv::traits::Type<double>::<unnamed enum>’ is deprecated [-Werror=deprecated-enum-enum-conversion]
533 | : flags(MAGIC_VAL + traits::Type<_Tp>::value + CV_MAT_CONT_FLAG), dims(2), rows(m), cols(n), data(0),
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[1]: *** [/home/user/src/alx/libalx/lib/recipes.inc.mk:53: /home/user/src/alx/libalx/tmp/cv/alx/compare.cxx.s] Error 1
make: *** [Makefile:72: cv] Error 2

Steps to reproduce

I compile with -Wall -Wextra -Werror. Including that header, using those warnings/errors, and the latest g++ should be enough to trigger the error.

Issue submission checklist

I report the issue, it's not a question

I checked the problem with documentation, FAQ, open issues,

forum.opencv.org, Stack Overflow, etc and have not found solution

BTW, I found this similar report: https://stackoverflow.com/questions/63601869/error-in-compiling-opencv-program-with-g-and-clang

I updated to latest OpenCV version and the issue is still there

There is reproducer code and related data files: videos, images, onnx, etc

-->