Quuxplusone added inline comments.
================ Comment at: clang/test/CodeGenCXX/nrvo.cpp:1537 + } + return x; // FIXME: NRVO could happen if B == false, but doesn't +} ---------------- Quuxplusone wrote: > Nit: `s/if/when/` Serendipitously, I just ran into almost this exact scenario in D120180, where C++20's `reverse_iterator` wants to do basically ``` { _Iter __tmp = current; --__tmp; if constexpr (is_pointer_v<_Iter>) { return __tmp; } else { return std::move(__tmp).operator->(); } } ``` and so we want NRVO on `__tmp` in the former case but URVO in the latter case. Of course in that specific case, we "want NRVO" only when `__tmp` is a pointer and thus NRVO doesn't apply anyway because pointers are returned in registers. But it would be nice to have a test case for as-close-as-possible to that pattern, if you don't mind adding one. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D119927/new/ https://reviews.llvm.org/D119927 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits