rjmccall added inline comments.

================
Comment at: lib/CodeGen/CGExprConstant.cpp:1340
+          return C;
+        return getNullPtr(PT, DestType);
       }
----------------
efriedma wrote:
> Consider code like the following:
> 
>     int x = 0;
>     auto y1 = (__specialaddrspace int*)0;
>     auto y2 = (__specialaddrspace int*)((void)0, 0);
>     auto y3 = (__specialaddrspace int*)x;
> 
> How do you expect these three cases to behave?  (The first case involves a C 
> null pointer constant, the second and third cases are different ways of 
> writing a general int->ptr conversion.)
Yeah, I think you probably need to fix APValue to be unambiguous about whether 
the value is a formal null pointer (CK_NullToPointer) or just a cast of an 
integer (CK_IntegralToPointer).  It looks like PointerExprEvaluator will 
generate the exact same value for both.


https://reviews.llvm.org/D26196



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to