================ Comment at: lib/AST/ExprConstant.cpp:5006-5010 @@ -5005,1 +5005,7 @@ + // Empty struct or union in C has size 0 (GCC extension). Meaning of + // pointer difference in such case is unspecified, so set ElementSize + // to 1 to avoid division by zero. + if (ElementSize.isZero()) + ElementSize = CharUnits::One(); + ---------------- If behavior is undefined here, we should just refuse to evaluate the expression as a constant. Produce a diagnostic (with Info.Diag(E, diag::note_whatever)) and return false.
http://llvm-reviews.chandlerc.com/D637 _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
