From f75152a597949d7e68b26575441397a321b2ed56 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Mon, 25 Mar 2019 17:56:55 +0300 Subject: [PATCH] gapi: fix build with Intel Compiler 2019 --- modules/gapi/include/opencv2/gapi/util/variant.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/gapi/include/opencv2/gapi/util/variant.hpp b/modules/gapi/include/opencv2/gapi/util/variant.hpp index cb0270a73d..a7e43c5569 100644 --- a/modules/gapi/include/opencv2/gapi/util/variant.hpp +++ b/modules/gapi/include/opencv2/gapi/util/variant.hpp @@ -328,7 +328,8 @@ namespace util util::type_list_index::value; if (v.index() == t_index) - return reinterpret_cast(v.memory); + return *(T*)(&v.memory); // workaround for ICC 2019 + // original code: return reinterpret_cast(v.memory); else throw_error(bad_variant_access()); } @@ -340,7 +341,8 @@ namespace util util::type_list_index::value; if (v.index() == t_index) - return reinterpret_cast(v.memory); + return *(const T*)(&v.memory); // workaround for ICC 2019 + // original code: return reinterpret_cast(v.memory); else throw_error(bad_variant_access()); }