[clang] [clang-tools-extra] [Clang] Implement CWG2813: Class member access with prvalues (PR #120223)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 17 06:30:29 PST 2024


================
@@ -1128,26 +1119,68 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
     BaseExpr = BuildCXXThisExpr(Loc, BaseExprType, /*IsImplicit=*/true);
   }
 
+  // C++17 [expr.ref]p2, per CWG2813:
+  //   For the first option (dot), if the id-expression names a static member or
+  //   an enumerator, the first expression is a discarded-value expression; if
+  //   the id-expression names a non-static data member, the first expression
+  //   shall be a glvalue.
+  auto MakeDiscardedValue = [&] {
----------------
erichkeane wrote:

I would prefer some more descriptive names here?  Perhaps `ConvertBaseExprToDiscardedValue` and `ConvertBaseExprToGLValue` ?  

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


More information about the cfe-commits mailing list