hubert.reinterpretcast marked 3 inline comments as done.
hubert.reinterpretcast added inline comments.


================
Comment at: lib/AST/ExprConstant.cpp:6147-6148
+      return ZeroInitialization(E);
+    if (!Result.checkNullPointerForFoldAccess(Info, E, AK_Read))
+      return false;
+    QualType CharTy =
----------------
rsmith wrote:
> hubert.reinterpretcast wrote:
> > rsmith wrote:
> > > Why do we need to do this explicitly, rather than allowing to simply 
> > > happen as part of the first `handleLValueToRValueConversion` below?
> > We want the error message to be produced even if we bail early on not 
> > having a valid designator.
> If we have an invalid designator, we already produced a diagnostic when 
> setting it invalid, and generally don't need to diagnose anything else.
The null pointer diagnostic does not get produced if we do not do the check 
here on cases like the following:
```
static_assert(__builtin_memchr((int *)0, 0, 1) == 0, "");
```



Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55510/new/

https://reviews.llvm.org/D55510



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

Reply via email to