Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/hlsl.y:
+ const struct list *next = &check->entry; + struct hlsl_ir_switch_case *c; + + if (check->is_default) + return; + + while ((next = list_next(cases, next))) + { + c = LIST_ENTRY(next, struct hlsl_ir_switch_case, entry); + if (c->is_default) continue; + if (c->value == check->value) + { + hlsl_error(ctx, &c->loc, VKD3D_SHADER_ERROR_HLSL_DUPLICATE_SWITCH_CASE, "Found duplicate 'case' statement."); + hlsl_note(ctx, &check->loc, VKD3D_SHADER_LOG_ERROR, "The same 'case' statement was previously found here."); + } + } That's still going to be not pretty if there are three or more cases with the same value. I guess in this case we want to emit an error for each case starting from the second one, and a note pointing to the first one. So you'd rather iterate on the previous cases rather then on the following, and break out as soon as you emit an error.
-- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/361#note_49697