tahonermann added inline comments.

================
Comment at: clang/lib/Sema/SemaInit.cpp:5959
   if (DestType->isRecordType()) {
+    assert(Initializer && "Intializer must be non-null");
     //     - If the initialization is direct-initialization, or if it is
----------------
It looks like this assertion was triggered for both the Linux and Windows 
builds.

Since the `else` branch below unconditionally dereferences `Initializer`, I 
think the only way for `Initializer` to be null and for a crash not to occur is 
if the `then` branch is taken, but without `Initializer->getBeginLoc()` being 
evaluated due to short circuiting. I think we should do this:
1) Add a `Initializer &&` condition prior to the call to 
`S.IsDerivedFrom(Initializer->getBeginLoc(), ...)`. This will require yet more 
parenthesis for the conditional logic.
2) Add the assert to the `else` branch.


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

https://reviews.llvm.org/D139148

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

Reply via email to