diff --git a/tools/qfcc/include/type.h b/tools/qfcc/include/type.h index 41e2eef3e..ca079eb01 100644 --- a/tools/qfcc/include/type.h +++ b/tools/qfcc/include/type.h @@ -181,6 +181,7 @@ int is_func (const type_t *type) __attribute__((pure)); int is_string (const type_t *type) __attribute__((pure)); int type_compatible (const type_t *dst, const type_t *src) __attribute__((pure)); int type_assignable (const type_t *dst, const type_t *src); +int type_same (const type_t *dst, const type_t *src) __attribute__((pure)); int type_size (const type_t *type) __attribute__((pure)); void init_types (void); diff --git a/tools/qfcc/source/def.c b/tools/qfcc/source/def.c index 37a06c84e..df1d36b94 100644 --- a/tools/qfcc/source/def.c +++ b/tools/qfcc/source/def.c @@ -529,7 +529,7 @@ initialize_def (symbol_t *sym, expr_t *init, defspace_t *space, reloc_t *relocs = 0; if (check && check->table == current_symtab) { - if (check->sy_type != sy_var || check->type != sym->type) { + if (check->sy_type != sy_var || !type_same (check->type, sym->type)) { error (0, "%s redefined", sym->name); } else { // is var and same type diff --git a/tools/qfcc/source/type.c b/tools/qfcc/source/type.c index bb211267a..3c6a4a683 100644 --- a/tools/qfcc/source/type.c +++ b/tools/qfcc/source/type.c @@ -1066,6 +1066,15 @@ type_assignable (const type_t *dst, const type_t *src) return 0; } +int +type_same (const type_t *dst, const type_t *src) +{ + dst = unalias_type (dst); + src = unalias_type (src); + + return dst == src; +} + int type_size (const type_t *type) {