Skip to content

[SUGGESTION] if (i==j) gives clang warning about (i==j) #457

@realgdman

Description

@realgdman

if (i==j) in cpp2, when lowered to cpp1, encloses condition in parens if ((i==j))
Which is, probably, for good, but in modern C++, for example clang, gives a warning

https://cpp2.godbolt.org/z/av3ech559

warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
note: remove extraneous parentheses around the comparison to silence this warning
note: use '=' to turn this equality comparison into an assignment

It can be a problem if "threat warnings as error" enabled, in case of mixed cpp1/cpp2.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions