[libcxx-commits] [PATCH] D113161: [libc++] Implement P1989R2: range constructor for string_view

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Nov 21 10:37:45 PST 2021


Quuxplusone added a comment.

@jloser: Found it! You need to do this in `<filesystem>`:

     friend _LIBCPP_INLINE_VISIBILITY bool operator==(const path& __lhs, const path& __rhs) noexcept {
  -    return __lhs.compare(__rhs) == 0;
  +    return __lhs.__compare(__rhs.__pn_) == 0;
     }

(and likewise for each of `path`'s six comparison operators).
The problem is that instantiating `path` instantiates `operator==`, which triggers overload resolution on `__lhs.compare(__rhs)`, which evaluates whether `__rhs` can be converted to `string_view`... and at that point, it //cannot// (because its iterator type is still incomplete at that point). So, it goes boom. The hack-around is to make sure we don't call anything that might ever try to convert `path` to `string_view` before its time.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113161



More information about the libcxx-commits mailing list