[clang] [clang][ExprConstant] Reject integral casts of addr-label-diffs... (PR #171437)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 11 07:32:49 PST 2025


================
@@ -12,7 +12,7 @@
 
 // CHECK:  |   |-value: AddrLabelDiff &&l2 - &&l1
 int Test(void) {
-  constexpr char ar = &&l2 - &&l1;
+  constexpr long long ar = &&l2 - &&l1;
----------------
tbaederr wrote:

Oh, I guess we don't? 
We also don't reject widening casts in sema today:
```c
int b(void) {
  static unsigned __int128 ar = &&l2 - &&l1; // error
l1:
  return 10;
l2:
  return 11;
}
```
but we don't constant fold them.

https://github.com/llvm/llvm-project/pull/171437


More information about the cfe-commits mailing list