Skip to content

[clang-tidy] False positive readability-redundant-parentheses when macro is present #164125

@chrchr-github

Description

@chrchr-github
#include <algorithm>
#define min(x, y) x

int f(int a, int b) {
    return (std::min)(a, b);
}
<source>:5:12: warning: redundant parentheses around expression [readability-redundant-parentheses]
    5 |     return (std::min)(a, b);
      |            ^  

The suggested fix causes a compilation error, besides possibly changing the semantics.
https://godbolt.org/z/eE74Ws3fd

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions