diff --git a/modules/core/src/ocl.cpp b/modules/core/src/ocl.cpp index bb395b3cda..d1791d83bd 100644 --- a/modules/core/src/ocl.cpp +++ b/modules/core/src/ocl.cpp @@ -190,7 +190,7 @@ void traceOpenCLCheck(cl_int status, const char* message) CV_OCL_TRACE_CHECK_RESULT(check_result, msg); \ if (check_result != CL_SUCCESS) \ { \ - if (0) { const char* msg_ = (msg); CV_UNUSED(msg_); /* ensure const char* type (cv::String without c_str()) */ } \ + static_assert(std::is_convertible::value, "msg of CV_OCL_CHECK_RESULT must be const char*"); \ cv::String error_msg = CV_OCL_API_ERROR_MSG(check_result, msg); \ CV_Error(Error::OpenCLApiCallError, error_msg); \ } \ @@ -210,7 +210,7 @@ void traceOpenCLCheck(cl_int status, const char* message) CV_OCL_TRACE_CHECK_RESULT(check_result, msg); \ if (check_result != CL_SUCCESS && isRaiseError()) \ { \ - if (0) { const char* msg_ = (msg); CV_UNUSED(msg_); /* ensure const char* type (cv::String without c_str()) */ } \ + static_assert(std::is_convertible::value, "msg of CV_OCL_DBG_CHECK_RESULT must be const char*"); \ cv::String error_msg = CV_OCL_API_ERROR_MSG(check_result, msg); \ CV_Error(Error::OpenCLApiCallError, error_msg); \ } \