[PATCH] D126735: [clang-tidy] Silence modernize-redundant-void-arg in the case of vexing parses

Richard via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 29 08:55:07 PDT 2023


LegalizeAdulthood added inline comments.
Herald added a reviewer: njames93.
Herald added a subscriber: PiotrZSL.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/modernize/redundant-void-arg.cpp:596
+
+// Explicitly specifying `(void)` is a way to sidestep -Wvexing-parse, so we
+// should not warn about it here.
----------------
This is not the only way to eliminate the vexing parse warning.  For instance, if the intention is to declare `foo` as a function not in this translation unit, then:

```
void most_vexing_parse() {
  extern int foo();
}
```
does the trick.

Why assume that the only way to fix vexing-parse is to add `(void)`?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126735/new/

https://reviews.llvm.org/D126735



More information about the cfe-commits mailing list