zequanwu added inline comments.
================ Comment at: clang/lib/Sema/SemaInit.cpp:8710 } + QualType fromType = op->getType(); + auto *fromDecl = fromType.getTypePtr()->getPointeeCXXRecordDecl(); ---------------- zequanwu wrote: > hans wrote: > > Can the reverse situation happen, where it's destType that's forward > > declared? > If we only consider normal class without template, I think it's not necessary. > Here is an example of forward-declared destType. > ``` > class B{}; > class A; > B *b; > A *a= b; > ``` > Even if A is defined as `class A: public B{};`, `A *a = b` is still not > valid, initializing pointer to derived class with pointer to base class. The reverse situation could happen in class template. ``` template<class C> class A{}; template<class C> class B; // template<class C> class B : public A<C>{}; compiles B<int> *b; A<int> *a = b; ``` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85390/new/ https://reviews.llvm.org/D85390 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits