[PATCH] D149904: Generic selection expressions that accept a type operand

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat May 6 05:41:09 PDT 2023


cor3ntin added inline comments.


================
Comment at: clang/include/clang/AST/Expr.h:5691
 
+  unsigned getIndexOfControllingExpression() const {
+    // If controlled by an expression, the first offset into the Stmt *
----------------
aaron.ballman wrote:
> erichkeane wrote:
> > What is the value of these functions, if they only return 0 or 1?
> I was on the fence about these -- it was a nice place to hang an assertion and get a "named constant", basically. I can drop them if you'd like.
I personally think it's cleaner and more consistent that way, I'd keep them 


================
Comment at: clang/test/Sema/generic-selection-type-extension.c:130
+#endif // __cplusplus
+
----------------
Can you add a type for something like that? 

```cpp
template <typename... T>
void f() {
    _Generic(T..., int : 1);
}```


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

https://reviews.llvm.org/D149904



More information about the cfe-commits mailing list