================
@@ -9346,9 +9346,12 @@ bool LValueExprEvaluator::VisitUnaryDeref(const 
UnaryOperator *E) {
   // [C++26][expr.unary.op]
   // If the operand points to an object or function, the result
   // denotes that object or function; otherwise, the behavior is undefined.
-  return Success &&
-         (!E->getType().getNonReferenceType()->isObjectType() ||
-          findCompleteObject(Info, E, AK_Dereference, Result, E->getType()));
+  // Because &(*(type*)0) is a common pattern, we do not fail the evaluation
+  // immediately.
+  if (!Success || !E->getType().getNonReferenceType()->isObjectType())
+    return Success;
+  return !!findCompleteObject(Info, E, AK_Dereference, Result, E->getType()) ||
----------------
tbaederr wrote:

Do we really prefer `!!` over `(bool)`? Or is this to avoid using a C cast?

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

Reply via email to