@@ -1275,16 +1275,17 @@ metac_sema_expr_t* MetaCSemantic_doExprSemantic_(metac_sema_state_t* self,
12751275 case expr_sizeof :
12761276 {
12771277 int32_t size = -1 ;
1278- hash = sizeof_key ;
12791278 metac_sema_expr_t * e1 =
12801279 MetaCSemantic_doExprSemantic (self , expr -> E1 , 0 );
1280+ metac_type_index_t typeIdx ;
1281+ hash = sizeof_key ;
12811282
12821283 while (e1 -> Kind == expr_paren )
12831284 {
12841285 e1 = e1 -> E1 ;
12851286 }
12861287
1287- metac_type_index_t typeIdx = e1 -> TypeIndex ;
1288+ typeIdx = e1 -> TypeIndex ;
12881289 // usually we assume the type of which we want
12891290 // to get the size is the type of the expression
12901291 if (e1 -> Kind == expr_type )
@@ -1293,15 +1294,18 @@ metac_sema_expr_t* MetaCSemantic_doExprSemantic_(metac_sema_state_t* self,
12931294 // which is something that resolves to a type such as the identifier int
12941295 typeIdx = e1 -> TypeExp ;
12951296 hash = CRC32C_VALUE (hash , e1 -> TypeExp );
1296- } else if (e1 -> TypeIndex .v == TYPE_INDEX_V (type_index_basic , type_type ))
1297+ }
1298+ else if (e1 -> TypeIndex .v == TYPE_INDEX_V (type_index_basic , type_type ))
12971299 {
12981300 // if the expression is any other kind of expression and it is of type type
12991301 // it indicates we want this sizeof be resolved at a later time
13001302 // possibly when calling a function
13011303 }
13021304
1303- if (e1 -> TypeIndex .v != 0 && e1 -> TypeIndex .v != -1 )
1305+ if (typeIdx .v != 0 && typeIdx .v != -1 )
1306+ {
13041307 size = MetaCSemantic_GetTypeSize (self , typeIdx );
1308+ }
13051309
13061310 result -> TypeIndex .v = TYPE_INDEX_V (type_index_basic , type_size_t );
13071311 result -> Kind = expr_signed_integer ;
0 commit comments