Fix sizeof member access after parenthesized expressions
authorRobert Pengelly <robertapengelly@hotmail.com>
Thu, 17 Sep 2026 07:49:25 +0000 (08:49 +0100)
committerRobert Pengelly <robertapengelly@hotmail.com>
Thu, 17 Sep 2026 07:49:25 +0000 (08:49 +0100)
parse.c

diff --git a/parse.c b/parse.c
index f783950df82ba123a19face077e34c10a0dcfe35..3d730893c899b6e2dbcacc0919e9c5f71a8bc18c 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -1107,8 +1107,17 @@ static int parse_sizeof_member_expr_size (int leading_stars, int consume_inner_r
     
     get_token ();
     
-    while (tok.kind == TOK_ARROW || tok.kind == TOK_DOT || tok.kind == TOK_LBRACK) {
+    while (tok.kind == TOK_ARROW || tok.kind == TOK_DOT || tok.kind == TOK_LBRACK || (consume_inner_rparen && tok.kind == TOK_RPAREN)) {
     
+        if (consume_inner_rparen && tok.kind == TOK_RPAREN) {
+        
+            get_token ();
+            
+            consume_inner_rparen = 0;
+            continue;
+        
+        }
+        
         if (tok.kind == TOK_LBRACK) {
         
             int depth = 1;
@@ -1246,10 +1255,6 @@ static int parse_sizeof_member_expr_size (int leading_stars, int consume_inner_r
     
     }
     
-    if (consume_inner_rparen && tok.kind == TOK_RPAREN) {
-        get_token ();
-    }
-    
     if (leading_stars > 0 && final_is_array) {
     
         int remaining_stars = leading_stars - 1;