================
@@ -69,6 +69,86 @@ void test5(void) {
   a.b = 100;
 }
 
+// GH223923: Do not diagnose conversions in unselected operands of constant
+// conditional expressions.
+#define BASE64_INIT_1(v, ch_62, ch_63) \
+  [v] = (v) >= 'A' && (v) <= 'Z' ? (v) - 'A' \
+      : (v) >= 'a' && (v) <= 'z' ? (v) - 'a' + 26 \
+      : (v) >= '0' && (v) <= '9' ? (v) - '0' + 52 \
+      : (v) == (ch_62) ? 62 : (v) == (ch_63) ? 63 : -1
----------------
ojhunt wrote:

I have a real concern about including this wholesome - this is GPL code. We 
just need a few targeted testcases, structurally?

```cpp
constant_expression ? invalid : valid
constant_expression ? valid : invalid
```

Now `constant_expression` should cover a pile of different cases:
* 0 and 1
* MACRO
* MACRO(some constant/constant expression), MACRO(non-constant) 
* static const int condition = ....; condition ? ...
* _Generic
* dependent expressions - sizeof(type), nttp, etc
* constexpr
* Dumb things: `variable_expression * 0`, `x == x`

The reason for this coverage is so we can consider whether we consider the 
result to be reasonable. I think filtering should no be all out, the "dumb 
ones" can go either way, I think we should just be sure that we know the outcome

https://github.com/llvm/llvm-project/pull/226775
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to