From fe50aeb130815e56f5ba79a8e6d0f4ce2687ab11 Mon Sep 17 00:00:00 2001 From: Henrixounez Date: Sun, 25 Aug 2019 19:51:59 +0200 Subject: [PATCH] compiler: prevent multiple same field initialization --- compiler/parser.v | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/parser.v b/compiler/parser.v index 6ab6c6eb64..81390b51e6 100644 --- a/compiler/parser.v +++ b/compiler/parser.v @@ -2856,6 +2856,9 @@ p.gen('($no_star*)memdup(&($no_star) {') //sizeof(Node)); if !t.has_field(field) { p.error('`$t.name` has no field `$field`') } + if inited_fields.contains(field) { + p.error('already initialized field `$field` in `$t.name`') + } f := t.find_field(field) inited_fields << field p.gen('.$field = ')