From: Robert Pengelly Date: Mon, 7 Sep 2026 13:17:37 +0000 (+0100) Subject: Fixed structure tag tracking for aggregate member declarations X-Git-Url: https://git.candlhat.org/?a=commitdiff_plain;h=92bce9b6f004365490ab6e7e342a6bd9a933a67f;p=scc.git Fixed structure tag tracking for aggregate member declarations --- diff --git a/parse.c b/parse.c index 17fdae4..1706e24 100644 --- a/parse.c +++ b/parse.c @@ -3577,6 +3577,18 @@ void parse_type_spec (void) { parsed_type_has_tag = has_tag; parsed_type_is_packed = aggregate_is_packed; + /* + * Parsing member declarations may replace parsed_type_tag_name + * with the type of the last member. Restore the enclosing + * aggregate tag before its typedef/declarator is recorded. + */ + if (has_tag && tag_name) { + + strncpy (parsed_type_tag_name, tag_name, sizeof (parsed_type_tag_name) - 1); + parsed_type_tag_name[sizeof (parsed_type_tag_name) - 1] = '\0'; + + } + clear_parsed_fields (); if (is_union) {