'How can I compile my project with c++20 with an OpenCV dependency?

I am trying to build my project with the c++20 flag on g++-11. My project depends on some headers in opencv.hpp from OpenCV 4.0, and now I'm getting compiler errors from these header files. I can't tell from OpenCV's docs if they support compiling with the c++20 flag. Where can I find that info?

Also is there a way to get around these errors? How could I compile their code with an older c++ standard?, but my code with c++20?

Here's a snippet of the compiler error that I'm seeing:

In file included from /usr/include/opencv4/opencv2/core/mat.hpp:3724,
                 from /usr/include/opencv4/opencv2/core.hpp:59,
                 from /usr/include/opencv4/opencv2/opencv.hpp:52,
                 from /my_project/include/amp_ffmpeg/decoder.hpp:3,
                 from /my_project/src/decoder.cpp:1:
/usr/include/opencv4/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputArray::_InputArray(const cv::Mat&)’:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:88:57: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
   88 | 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:89:83: error: arithmetic between different enumeration types ‘cv::_InputArray::KindFlag’ and ‘cv::AccessFlag’ is deprecated [-Werror=deprecated-enum-enum-conversion]
   89 | inline _InputArray::_InputArray(const std::vector<Mat>& vec) { init(STD_VECTOR_MAT+ACCESS_READ, &vec); }



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source