[PATCH] D111400: [Clang] Implement P2242R3

Hubert Tong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 11 13:36:44 PST 2022


hubert.reinterpretcast added a comment.

@aaron.ballman, I haven't had a chance to look at the code in detail yet, but I would like to get on the same page about the error/warning behaviour.

In the older modes, we stay conforming either

- by producing the warning (when we know the user said they wanted the function to be `constexpr`) and letting the code through or
- by doing what the older document says because a warning is inappropriate at the point of the check and we have no mechanism developed (including for other similar cases) for producing the warning only when semantically significant later.

In C++2b, the `-Wc++20-compat` warning is produced for the places where we warn above and is not produced for the places where we don't warn above.

Considering that the warning would be something like "this function is not implicitly constexpr in C++20 but is so in C++23", and we probably will have a lot of such cases for other reasons, I can buy that people are not interested in such a warning.



================
Comment at: clang/test/CXX/basic/basic.types/p10.cpp:23
 extern BeingDefined beingdefined;
-struct BeingDefined { 
+struct BeingDefined {
   static constexpr BeingDefined& t = beingdefined;
----------------
Seems like the only change in this file is drive-by NFC. Can this be pulled out of this patch?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111400



More information about the cfe-commits mailing list