typeof(ref_asterisks(union { int z; typeof(ptr_type) x; }){0}.x)
#ifdef __GNUC__
-#define UL_CAST_UNQX(ref_asterisks, new_type, expr) ({ \
- UL_BUILD_BUG_ON_MSG(!__builtin_types_compatible_p\
+/* Const and volatile qualifiers removal cast
+ * The expression is cast by (typeof((typeof(new_type[1])){0}[0]))
+ * which is equivalent to (new_type) cast for matching types.
+ * This quite complicated method is used because both comma operator
+ * and compound expressions are not allowed in global variables
+ * initializers.
+ */
+#define UL_CAST_UNQX(ref_asterisks, new_type, expr) ( \
+ (typeof((typeof(new_type[1 - 2 * \
+ !__builtin_types_compatible_p \
(UL_TYPEOF_REFX(ref_asterisks, expr), \
- UL_TYPEOF_REFX(ref_asterisks,new_type)), \
- "Qualifiers stripping cast to incompatible type"); \
- (new_type)(expr); \
-})
+ UL_TYPEOF_REFX(ref_asterisks, new_type)) \
+ ])){0}[0]) \
+ ) \
+ (expr) \
+)
#else /*__GNUC__*/
#define UL_CAST_UNQX(ref_asterisks, new_type, expr) ((new_type)(expr))
#endif /*__GNUC__*/