return false;
}
-/**
- * Check if two pointer types are compatible.
- */
-bool pointers_compatible(const type_t *type1, const type_t *type2)
-{
- assert(!is_typeref(type1));
- assert(!is_typeref(type2));
-
- assert(type1->kind == TYPE_POINTER);
- assert(type2->kind == TYPE_POINTER);
- (void) type1;
- (void) type2;
- /* TODO */
- return true;
-}
-
/**
* Skip all typerefs and return the underlying type.
*/
}
if (qualifiers != TYPE_QUALIFIER_NONE) {
- type_t *const copy = duplicate_type(type);
- copy->base.qualifiers |= qualifiers;
+ type_t *const copy = duplicate_type(type);
+
+ /* for const with typedefed array type the element type has to be
+ * adjusted */
+ if (is_type_array(copy)) {
+ type_t *element_type = copy->array.element_type;
+ element_type = duplicate_type(element_type);
+ element_type->base.qualifiers |= qualifiers;
+ copy->array.element_type = element_type;
+ } else {
+ copy->base.qualifiers |= qualifiers;
+ }
type = typehash_insert(copy);
if (type != copy) {