vsapsai added inline comments.

================
Comment at: clang/lib/Sema/SemaDecl.cpp:17067
+void Sema::ActOnObjCTemporaryExitContainerContext(ObjCContainerDecl *ObjCCtx) {
+  auto DC = cast<DeclContext>(ObjCCtx);
   assert(DC == CurContext && "Mismatch of container contexts");
----------------
jansvoboda11 wrote:
> vsapsai wrote:
> > jansvoboda11 wrote:
> > > Why the cast? We should be able to compare/assign `ObjCContainerDecl *` 
> > > to `DeclContext *`.
> > I believe you are right and the cast is not required. Though we cannot 
> > compare `ObjCCtx` and `CurContext`, we need to compare `DeclContext *DC`.
> > 
> > Also dropped a similar cast in `ActOnObjCContainerStartDefinition`.
> Interesting, I would expect that `ObjCCtx == CurContext` would have implicit 
> upcast of `ObjCCtx` to `DeclContext *`. Same for the assignment.
D'oh, relying on values in debugger isn't always correct. You are right, 
according to [expr.eq]p2 both operands are brought to their composite pointer 
type and [conv.ptr]p3 allows upcasting, so we don't need to have variables of 
the same time for comparison.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124285

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

Reply via email to