[PATCH] D136554: Implement CWG2631

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 3 12:39:43 PDT 2022


cor3ntin marked 8 inline comments as done.
cor3ntin added inline comments.


================
Comment at: clang/include/clang/Sema/Sema.h:9602-9604
+    return Ctx.Context ==
+               ExpressionEvaluationContext::PotentiallyEvaluatedIfUsed ||
+           Ctx.IsCheckingDefaultArgumentOrInitializer;
----------------
shafik wrote:
> aaron.ballman wrote:
> > Hmm, it'd be nice to not name this with the same identifier as the `bool` member on line 1333, that surprised me a little bit when I ran into it below.
> Why are we logically ORing an enumerator w/ a `bool`?
I added parentheses here to make that clearer!


================
Comment at: clang/lib/Sema/SemaExpr.cpp:5918
+    if (const FunctionDecl *FD = E->getDirectCallee())
+      HasImmediateCalls |= FD->isConsteval();
+    return RecursiveASTVisitor<ImmediateCallVisitor>::VisitStmt(E);
----------------
@shafk 


================
Comment at: clang/test/SemaCXX/cxx2a-consteval-default-params.cpp:10
+    {
+        return undefined();  // expected-error {{not a constant expression}} \
+                             // expected-note  {{undefined function 'undefined'}}
----------------
cor3ntin wrote:
> shafik wrote:
> > I don't think we expect a diagnostic here since `check_lambdas_unused` is never called.
> We do because the body of a lambda is not considered a subexpression. I confirmed that with core.
> 
> See https://lists.isocpp.org/core/2022/10/13364.php
I added a comment


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136554



More information about the cfe-commits mailing list