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

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 11 14:50:41 PDT 2025


================
@@ -5243,7 +5245,19 @@ static bool EvaluateVarDecl(EvalInfo &Info, const VarDecl *VD) {
   if (InitE->isValueDependent())
     return false;
 
-  if (!EvaluateInPlace(Val, Info, Result, InitE)) {
+  if (VD->getType()->isReferenceType() && InitE->isGLValue()) {
----------------
efriedma-quic wrote:

Isn't the isGLValue() check here redundant?  If it wasn't a GLValue, we should have bailed out earlier.

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


More information about the cfe-commits mailing list