Paul Eggert <[email protected]> writes: > I asked Gemini, and it replied that these hacks probably won't work. It > also said that the bug with MSVC's enum warnings (C5287) being generated > for benign expressions like +X < +Y has been reported to Microsoft. A > Google search suggests that a fix is on the way, giving this URL:
> https://developercommunity.visualstudio.com/t/False-positive-C5287:-operands-are-diff/10915265?sort=newest > ... a URL that I don't have access to read, unfortunately. Hmm ... I don't have any special access either, but I was able to read https://developercommunity.visualstudio.com/t/warning-C5287:-operands-are-different-e/10877942 which says specifically that this gave a warning as of MSVC 19.44.34918.1: ee = (int)((int)e1_1 | (int)e2_1) and that Microsoft acknowledged that as a bug and fixed it in some later release (doesn't say which unfortunately). This isn't exactly the situation zic.c presents, but it seems likely that it'd apply. I don't see anything indicating that they made it be silent without a cast; maybe they did but there's no evidence of that here. I'm not really following your aversion to a cast. Surely none of these constants will ever come close to exceeding INT_MAX. And I don't buy that applying "+" is less of a hack. Anyway, on the other point: the unsigned warning isn't only on old MSVC versions. I see it also on the latest that we have in the Postgres buildfarm, 19.50.35726. I only meant to comment that it appears on a wider range of MSVC versions than the inconsistent-enum-types one. regards, tom lane
