-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Compilation warnings in opencv4/opencv2/core/types.hpp #16336
Copy link
Copy link
Closed
Labels
Hackathonhttps://opencv.org/opencv-hackathon-starts-next-week/https://opencv.org/opencv-hackathon-starts-next-week/affected: 3.4category: build/install
Milestone
Description
System information (version)
- OpenCV = 4.2.0 compiled from source, and installed in /usr/local/
- Operating System / Platform = Linux - debian Buster
- Compiler = g++ 8.3.0
Detailed description
A compile warning error pop-ups in the core/types.hpp file
when using -Wdouble-promotion gcc compilation flag.
usr/local/include/opencv4/opencv2/core/types.hpp:1419:88: required from here
/usr/local/include/opencv4/opencv2/core/types.hpp:1218:21: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
return (double)x*pt.x + (double)y*pt.y;
~~~~~~~~~^~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1218:38: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
return (double)x*pt.x + (double)y*pt.y;
How to reproduce
Just compile the following file:
#include <opencv2/core/types.hpp>
int main(void)
{
return 0;
}
with : g++ -Wall -Wdouble-promotion -o test test.cc -I/usr/local/include/opencv4/
How to fix
The problem is in the ddot template inside core/types.hpp line 1216.
Code should be changed to:
template<typename _Tp> inline
double Point_<_Tp>::ddot(const Point_& pt) const
{
return (double)x*(double)(pt.x) + (double)y*(double)(pt.y);
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Hackathonhttps://opencv.org/opencv-hackathon-starts-next-week/https://opencv.org/opencv-hackathon-starts-next-week/affected: 3.4category: build/install