[all-commits] [llvm/llvm-project] a96a6e: Implement CWG2631

cor3ntin via All-commits all-commits at lists.llvm.org
Thu Dec 8 01:33:08 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a96a6ed83230265f3eab09a94f0e9525d05f8a74
      https://github.com/llvm/llvm-project/commit/a96a6ed83230265f3eab09a94f0e9525d05f8a74
  Author: Corentin Jabot <corentinjabot at gmail.com>
  Date:   2022-12-08 (Thu, 08 Dec 2022)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/AST/ExprCXX.h
    M clang/include/clang/AST/Stmt.h
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/include/clang/Sema/Sema.h
    M clang/lib/AST/ASTImporter.cpp
    M clang/lib/AST/Decl.cpp
    M clang/lib/AST/ExprCXX.cpp
    M clang/lib/Parse/ParseCXXInlineMethods.cpp
    M clang/lib/Parse/ParseDeclCXX.cpp
    M clang/lib/Sema/SemaDeclCXX.cpp
    M clang/lib/Sema/SemaExpr.cpp
    M clang/lib/Sema/SemaTemplateInstantiate.cpp
    M clang/lib/Sema/TreeTransform.h
    M clang/lib/Sema/UsedDeclVisitor.h
    M clang/lib/Serialization/ASTReaderStmt.cpp
    M clang/lib/Serialization/ASTWriterStmt.cpp
    M clang/test/CXX/class/class.local/p1-0x.cpp
    M clang/test/CXX/drs/dr26xx.cpp
    M clang/test/CodeGenCXX/builtin-source-location.cpp
    A clang/test/CodeGenCXX/default-arguments-with-immediate.cpp
    A clang/test/CodeGenCXX/meminit-initializers-odr.cpp
    A clang/test/PCH/default-argument-with-immediate-calls.cpp
    M clang/test/SemaCXX/cxx11-default-member-initializers.cpp
    A clang/test/SemaCXX/cxx2a-consteval-default-params.cpp
    M clang/test/SemaCXX/source_location.cpp
    M clang/www/cxx_dr_status.html

  Log Message:
  -----------
  Implement CWG2631

Implement https://cplusplus.github.io/CWG/issues/2631.html.

Immediate calls in default arguments and defaults members
are not evaluated.

Instead, we evaluate them when constructing a
`CXXDefaultArgExpr`/`BuildCXXDefaultInitExpr`.

The immediate calls are executed by doing a
transform on the initializing expression.

Note that lambdas are not considering subexpressions so
we do not need to transform them.

As a result of this patch, unused default member
initializers are not considered odr-used, and
errors about members binding to local variables
in an outer scope only surface at the point
where a constructor is defined.

Reviewed By: aaron.ballman, #clang-language-wg

Differential Revision: https://reviews.llvm.org/D136554




More information about the All-commits mailing list