Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Tönne <lukas.toenne@gmail.com>2015-12-11 18:16:11 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2015-12-11 18:18:42 +0300
commit8729e23f2dc245d7c73d98262d3b651b7c284249 (patch)
treec072a15b303d80a3c6481cabfb792d998dd3a47a
parente301fcf8e72ac6539e770000880cd24d460fbd6e (diff)
Fix for invalid void* to typed pointer assignment in bmesh when used in C++ code.
C++ does not allow the assignment of a void pointer to a typed pointer without explicit casting. Since we use a generic macro in bmesh for iterators we only ever get a void* back and cannot cast it to the target type. However, casting the target to a void* as well solves that issue. This tweak is #ifdef'd to be used in C++ code only.
-rw-r--r--source/blender/bmesh/bmesh_class.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/bmesh/bmesh_class.h b/source/blender/bmesh/bmesh_class.h
index 16e8285902a..4ffa0bda71a 100644
--- a/source/blender/bmesh/bmesh_class.h
+++ b/source/blender/bmesh/bmesh_class.h
@@ -276,8 +276,16 @@ enum {
#define BM_CHECK_TYPE_ELEM(ele) \
CHECK_TYPE_ANY(ele, _BM_GENERIC_TYPE_ELEM_NONCONST, _BM_GENERIC_TYPE_ELEM_CONST)
+/* Assignment from a void* to a typed pointer is not allowed in C++,
+ * casting the LHS to void works fine though.
+ */
+#ifdef __cplusplus
+#define BM_CHECK_TYPE_ELEM_ASSIGN(ele) \
+ (BM_CHECK_TYPE_ELEM(ele)), *((void **)&ele)
+#else
#define BM_CHECK_TYPE_ELEM_ASSIGN(ele) \
(BM_CHECK_TYPE_ELEM(ele)), ele
+#endif
/* BMHeader->hflag (char) */
enum {