[PATCH] D131479: Handle explicitly defaulted consteval special members.

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 10 03:24:58 PDT 2022


ilya-biryukov added a comment.

Should we follow suggestion from CWG Issue 2602 <https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#2602> to fix this instead?
I think the trick is to keep the constructor consteval, but complain when processing its call, e.g. somewhere around `HandleConstructorCall` in `ExprConstant.cpp`?



================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:7207
+    Sema::InheritedConstructorInfo *Inherited = nullptr,
+    CXXMethodDecl *SpecialMemberDecl = nullptr) {
   if (!S.getLangOpts().CPlusPlus11)
----------------
The function attempts to check whether the `implicitly` defined member would be `constexpr`, which should not depend on what is written in the expliclitly defaulted declaration.

So the check should definitely be performed somewhere outside this function.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131479



More information about the cfe-commits mailing list