Ensure that references are initialised.
authorChristoph Mallon <christoph.mallon@gmx.de>
Wed, 19 Nov 2008 07:39:18 +0000 (07:39 +0000)
committerChristoph Mallon <christoph.mallon@gmx.de>
Wed, 19 Nov 2008 07:39:18 +0000 (07:39 +0000)
[r23792]

parser.c

index 703b860..29e5761 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -5199,6 +5199,10 @@ static void parse_declaration_rest(entity_t *ndeclaration,
 
                if (token.type == '=') {
                        parse_init_declarator_rest(entity);
+               } else if (entity->kind == ENTITY_VARIABLE &&
+                               is_type_reference(skip_typeref(entity->declaration.type))) {
+                       errorf(&entity->base.source_position,
+                                       "reference %Y must be initialized", entity->base.symbol);
                }
 
                check_variable_type_complete(entity);