[PATCH] D130268: [NFC] Add SmallVector constructor to allow creation of SmallVector<T> from ArrayRef of items convertible to type T
Dawid Jurczak via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 29 02:00:25 PDT 2022
yurai007 added a comment.
In D130268#3684244 <https://reviews.llvm.org/D130268#3684244>, @nikic wrote:
> I think my only concern with this change is that it will also allow some implicit ArrayRef constructors. For example, this will permit creating a SmallVector from `std::array`, `std::vector`, or just `T` -- but only if `ArrayRef` is in scope. This seems somewhat dangerous.
Maybe I'm missing something, but is it right? It appears that only one implicit conversion in constructor is allowed: https://stackoverflow.com/questions/63320366/double-implicit-conversion-in-c
I think going from vector/array to SmallVector is ill-formed unless we explicitly create temporary ArrayRef in-between: https://godbolt.org/z/Geqbajf1x
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130268/new/
https://reviews.llvm.org/D130268
More information about the cfe-commits
mailing list