xazax.hun added a comment. In D66486#1643374 <https://reviews.llvm.org/D66486#1643374>, @mgehre wrote:
> > Also it feels a bit weird to change the ownership semantics in a derived > > class, I bet that would violate the Liskov substitution principle. > > And then we see that llvm::OwningArrayRef inherits from llvm::ArrayRef ... > But maybe this direction (strengthening a Pointer into an Owner) > is okay. I am not sure. Consider the following code: ArrayRef f() { ArrayRef r = getRef(); return r; } According to the substitution principle I should be able to replace `r` with a derived class: ArrayRef f() { OwningArrayRef r = getOwningRef(); return r; } But this will introduce a lifetime issue. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D66486/new/ https://reviews.llvm.org/D66486 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits