[libcxx-commits] [clang] [libcxx] [Clang] Diagnose forming references to nullptr (PR #143667)

Shafik Yaghmour via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 15 11:30:36 PDT 2025


================
@@ -9293,7 +9344,10 @@ bool LValueExprEvaluator::VisitArraySubscriptExpr(const ArraySubscriptExpr *E) {
 }
 
 bool LValueExprEvaluator::VisitUnaryDeref(const UnaryOperator *E) {
-  return evaluatePointer(E->getSubExpr(), Result);
+  bool Success = evaluatePointer(E->getSubExpr(), Result);
+  return Success &&
+         (!E->getType().getNonReferenceType()->isObjectType() ||
----------------
shafik wrote:

Can you add a comment explaining this additional check added after the `Success` check.

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


More information about the libcxx-commits mailing list