[PATCH] D104500: [clang] Apply P1825 as Defect Report from C++11 up to C++20.
Arthur O'Dwyer via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 8 15:44:29 PDT 2021
Quuxplusone added a comment.
In D104500#2864909 <https://reviews.llvm.org/D104500#2864909>, @mizvekov wrote:
> In D104500#2863368 <https://reviews.llvm.org/D104500#2863368>, @jyknight wrote:
>
>> This commit seems to have broken libc++ in C++98 mode, as it appears to have depended upon the implicit-move extension.
>> The root cause appears to be that libc++ emulates unique_ptr in c++98 mode, and this emulation stopped working.
>
> It's not that hard, right now, to put that support back in.
> But with C++11 up to C++20 sharing the same code, this is a lot of burden to have yet another implicit move mechanism just for C++98.
@mizvekov, I don't understand what you mean by "yet another" mechanism. This is just asking to restore Clang's C++98/03 extension (that supports move constructors even in C++03). It's asking to //remove// special-case code you added, right? Find the line where you're saying "oh but if it's C++03 then //don't// do the usual rvalue lookup," and remove that.
My naive guess is line 3459:
if (getLangOpts().CPlusPlus11 && !getLangOpts().CPlusPlus2b &&
NRInfo.isMoveEligible()) {
should maybe be just
if (!getLangOpts().CPlusPlus2b && NRInfo.isMoveEligible()) {
Could you look into that?
> And I think libc++ is in the process of ditching support for C++98 completely, though I might be mistaken about the extent here.
Nope, untrue. I've been making some patches to ditch libc++'s `_LIBCPP_CXX03_LANG` macro, but I'm doing that precisely because the only compiler we support in C++03 mode is Clang, and on Clang we //can// actually use rvalue references and variadic templates and so on, even in C++03 mode. That is, this extension (that was broken by this patch) is actually //the only reason libc++ works in C++03 mode at all!// So it's important to preserve the extension. (And presumably there might be clients relying on the extension, besides just libc++.)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104500/new/
https://reviews.llvm.org/D104500
More information about the cfe-commits
mailing list