================
Comment at: test/Sema/empty1.cpp:3-5
@@ +2,4 @@
+
+int func_1(int (*p1)[0], int (*p2)[0]) {
+  return p1 - p2;  // expected-warning {{subtraction of pointers to type 'int 
[0]' of zero size has undefined behavior}}
+}
----------------
Please also add a test for the constant expression handling. Something like

constexpr int (*p1)[0] = 0, (*p2)[0] = 0;
constexpr int k = p2 - p1;

================
Comment at: lib/AST/ExprConstant.cpp:6412
@@ +6411,3 @@
+        if (ElementSize.isZero()) {
+          CCEDiag(E, diag::note_constexpr_pointer_subtraction_zero_size_types);
+          return false;
----------------
This should be a Diag not a CCEDiag, because you're bailing out.


http://llvm-reviews.chandlerc.com/D637
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to