================ @@ -14544,6 +14538,23 @@ EvaluateComparisonBinaryOperator(EvalInfo &Info, const BinaryOperator *E, (LHSValue.Base && isZeroSized(RHSValue))) return DiagComparison( diag::note_constexpr_pointer_comparison_zero_sized); + // A constexpr-unknown reference can be equal to any other lvalue, except + // for variables allocated during constant evaluation. (The "lifetime + // [...] includes the entire constant evaluation", so it has to be + // distinct from anything allocated during constant evaluation.) + // + // Theoretically we could handle other cases, but the standard doesn't say + // what other cases we need to handle; it just says an "equality + // operator where the result is unspecified" isn't a constant expression. ---------------- efriedma-quic wrote:
Okay, I removed the checks for objects from the current evaluation, and my comment about the standard. I'd like to get this in because it's fixing a clear miscompile of pointer comparisons; we can worry about the finer details in a followup once the CWG decides what to do. https://github.com/llvm/llvm-project/pull/147663 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits