preliminary Win32 support added
[cparser] / parser.c
index ed248f4..6c78507 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -505,19 +505,16 @@ static void stack_pop_to(stack_entry_t **stack_ptr, size_t new_top)
                                symbol->declaration = declaration->symbol_next;
                        } else {
                                symbol->declaration = old_declaration;
-                               assert(old_declaration->symbol_next ==
-                                      declaration->symbol_next);
                        }
                } else {
                        declaration_t *iter_last = declaration;
-                       declaration_t *iter      = declaration->next;
+                       declaration_t *iter      = declaration->symbol_next;
                        for( ; iter != NULL; iter_last = iter, iter = iter->symbol_next) {
                                /* replace an entry? */
                                if(iter->namespace == namespace) {
                                        assert(iter_last != NULL);
                                        iter_last->symbol_next = old_declaration;
-                                       assert(old_declaration->symbol_next ==
-                                              declaration->symbol_next);
+                                       old_declaration->symbol_next = iter->symbol_next;
                                        break;
                                }
                        }
@@ -2771,6 +2768,15 @@ static void semantic_take_addr(unary_expression_t *expression)
        if(orig_type == NULL)
                return;
 
+       expression_t *value = expression->value;
+       if(value->type == EXPR_REFERENCE) {
+               reference_expression_t *reference   = (reference_expression_t*) value;
+               declaration_t          *declaration = reference->declaration;
+               if(declaration != NULL) {
+                       declaration->address_taken = 1;
+               }
+       }
+
        expression->expression.datatype = make_pointer_type(orig_type, 0);
 }