aaron.ballman 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
----------------
LegalizeAdulthood wrote:
> 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 `:)`
> 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?

It falls out from the grammar:

http://eel.is/c++draft/enum#nt:enumerator-definition
http://eel.is/c++draft/expr.const#nt:constant-expression
http://eel.is/c++draft/expr.cond#nt:conditional-expression

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

It can show up in paren expressions and the interface is generally about 
integer literal expressions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125622

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to