System information (version)
- OpenCV => at least 3.1 but also 4.1.1
- Operating System / Platform => Linux
- Compiler => >= gcc 7.1
Detailed description
When converting typed cv::Mat_<...> from one type to another with gcc >= 7.1 with c++17 enabled an endless recursion is generated leading to a stack overflow, thus the software is terminated with a segfault. In c++14 mode this issue does not occure.
I created a summary version of the Mat classes in godbolt where you can see the issue directly in assembly: https://gcc.godbolt.org/z/f8vFZj
Steps to reproduce
Compile this short example with c++ 17 enabled:
#include "opencv2/core.hpp"
int main()
{
cv::Mat_<unsigned char> m1;
cv::Mat_<signed char> m2{m1};
return 0;
}
Or see the example on godbolt above.
System information (version)
Detailed description
When converting typed cv::Mat_<...> from one type to another with gcc >= 7.1 with c++17 enabled an endless recursion is generated leading to a stack overflow, thus the software is terminated with a segfault. In c++14 mode this issue does not occure.
I created a summary version of the Mat classes in godbolt where you can see the issue directly in assembly: https://gcc.godbolt.org/z/f8vFZj
Steps to reproduce
Compile this short example with c++ 17 enabled:
Or see the example on godbolt above.