<regex>: Silence CodeQL false positive warning by StephanTLavavej · Pull Request #5072 · microsoft/STL (original) (raw)

Windows encountered internal OS-50456631 "[CodeQL:Warning]: SM02323: cpp/infiniteloop (in packages/[...]/regex)", reported to me by @DefaultRyan. According to the internal doc, this is:

[SM02323] Comparison of narrow type with wide type in loop condition
Comparisons between types of different widths in a loop condition can cause the loop to fail to terminate.

In this case, the warning is a false positive, and my suppression comment explains why.

Alternatively, we could widen the unsigned int to size_t, either with a static_cast or a named variable, but that'd be unusual enough to still merit a comment, so I chose the less invasive approach.