================
@@ -8503,8 +8503,12 @@ ExprResult InitializationSequence::Perform(Sema &S,
         Expr::EvalResult ER;
         if (Entity.getType()->getAs<PointerType>() &&
             CurInit.get()->EvaluateAsRValue(ER, S.Context) &&
-            !ER.Val.isNullPointer()) {
+            // We continue and let it error later if Rvalue is not a pointer
+            ER.Val.isLValue() && 
+            !ER.Val.isNullPointer() &&
+            !ER.Val.getLValueBase().isNull()) {
----------------
SamrudhNelli wrote:

I originally added !getLValueBase().isNull() to preserve the existing error 
message for int values rather than returning the new error message (intended 
for floats). This was due to the reason that int values return true for 
Lvalue() and getValueBase().isNull().

https://github.com/llvm/llvm-project/pull/180376
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to