[PATCH] D125622: [clang-tidy] Reject invalid enum initializers in C files

Richard via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 16 10:12:29 PDT 2022


LegalizeAdulthood added inline comments.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/modernize-macro-to-enum.c:9
+
+// C forbids comma operator in initializing expressions.
+#define BAD_OP 1, 2
----------------
aaron.ballman wrote:
> It's also forbidden in C++.
C++ just talks about a constant expression and doesn't explicitly disallow `operator,` in such expressions that I could find.  Can you point me to where it is disallowed?

If it is disallowed universally, then I don't see why you asked me to parse it `:)`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125622



More information about the cfe-commits mailing list