[PATCH] D128745: [c++] implements DR692, DR1395 and tentatively DR1432, about partial ordering of variadic template partial specialization or function template

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 4 12:05:44 PDT 2022


rjmccall added a comment.

In D128745#3833393 <https://reviews.llvm.org/D128745#3833393>, @royjacobson wrote:

> Is there consensus that applying this DR resolution is distruptive enough that it's actually an issue? If clang-abi-compat is not a good way to offer backwards compatibility in this case, maybe we should just leave it be.
>
> FWIW, I worry that applying it according to standard version will make it harder to write code that works cross version and the benefit here is not clear.

The same argument applies to limiting by target.  Platforms that choose to maintain a stable ABI should not be condemned to permanent non-conformance, creating additional obstacles to C++ portability.  And honestly, I think the target portability argument is much stronger than the standard-version portabillity argument.  It's not by any means uncommon to have C++ headers that need to work consistently under multiple language standards, but they also generally need to work on multiple compilers, and so they cannot necessarily rely on having this DR in place.  There's also an awful lot of C++ code that *doesn't* have to work under multiple standards because it's internal to a project that uses consistent build settings; but a lot of that code still needs to be portable to different platforms.  While some portability differences are unavoidable, we certainly don't want to create new differences.

More generally, language users understand that new language releases sometimes change existing language rules.  They don't always like it, but it is a standard part of the story of changing the target language standard.

It does seem like we don't have a good assessment of how likely a compatibility break is here in practice — whether this pattern comes up in common libraries and so on.  If it's vanishingly unlikely, maybe we can change this behavior unconditionally.  If it's likely enough for this to be a major problem, then I think the C++ committee really needs to think about whether this change is wise.  Maybe we can get more data on that.

I know that people sometimes have a strong reaction to feeling like the language is constrained by ABI compatibility concerns, so let me reiterate that this is *not* primarily about the ABI; it is about C++ introducing a semantic break something like 15 years after variadic templates were introduced to the language (11 years after standard release, but C++11 features were in wide use well before they became officially standardized).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128745



More information about the cfe-commits mailing list