================
@@ -32,3 +32,20 @@ void different_2() {
   int d = p2 - p1; // expected-warning{{Subtraction of two pointers that do 
not point into the same array is undefined behavior}} \
                    // expected-note{{Subtraction of two pointers that do not 
point into the same array is undefined behavior}}
 }
+
+int different_3() {
+  struct {
+    int array[5];
+  } a, b;
+  return &a.array[3] - &b.array[2]; // expected-warning{{Subtraction of two 
pointers that do not point into the same array is undefined behavior}} \
+                                    // expected-note{{Subtraction of two 
pointers that do not point into the same array is undefined behavior}}
+}
+
+int different_5() {
----------------
NagyDonat wrote:

```suggestion
int different_4() {
```
Very minor nitpick: `different_3` was followed by `different_5`.

https://github.com/llvm/llvm-project/pull/95899
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to