[clang] [Clang][C++23] Implement P2448R2: Relaxing some constexpr restrictions (PR #77753)

Mariya Podchishchaeva via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 5 07:25:52 PST 2024


Fznamznon wrote:

So, I've spent some time on it, and it turns out that because of current design choices supporting the whole feature in older language modes and not loosing any warnings/errors happens to be a much more significant change.
For example, due to the fact that constexprness of constructor/destructor can actually affect whether a class literal or not, to not loose any warnings it would require somehow preserve the info that a class is literal before and after c++23. The same actually works for each constructor/destructor declarations, now they would have to know not only whether they are constexpr, but whether they are constexpr before C++23, since bc of C++23 changes a number of implicit declarations became constexpr. Having this info only in parent class declaration is not enough, since at some point for each implicit member a `cxxconstructordecl` is created, and it can be later queried whether it is constexpr or not.
We can enable it as an extension in older language modes later as a separate patch in case there is user's demand on this.
@cor3ntin , @AaronBallman please let me know what you think.

https://github.com/llvm/llvm-project/pull/77753


More information about the cfe-commits mailing list