What do you do if you really do intend the assignment?
(Assume for the sake of argument it’s some more reasonable example like "if (x = re_match(foo, bar)) {...}")
(Assume for the sake of argument it’s some more reasonable example like "if (x = re_match(foo, bar)) {...}")
if (auto x = re_match(foo, bar); x.has_value()) {
(or x.ok() or whatever the name is of the method that tells you the validity of x)At least the systems I've seen need a extra (()) around = to disable the warnings and notify the reader that you're not just comparing for equality.