[all-commits] [llvm/llvm-project] 7acfe3: Implement CWG2631

cor3ntin via All-commits all-commits at lists.llvm.org
Fri Nov 4 06:46:53 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7acfe3629479c8489fc2d7f629994dc200be990c
      https://github.com/llvm/llvm-project/commit/7acfe3629479c8489fc2d7f629994dc200be990c
  Author: Corentin Jabot <corentinjabot at gmail.com>
  Date:   2022-11-04 (Fri, 04 Nov 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/Serialization/ASTReaderStmt.cpp
    M clang/lib/Serialization/ASTWriterStmt.cpp
    M clang/test/CXX/class/class.local/p1-0x.cpp
    M clang/test/CodeGenCXX/builtin-source-location.cpp
    A clang/test/CodeGenCXX/default-arguments-with-immediate.cpp
    A clang/test/PCH/default-argument-with-immediate-calls.cpp
    A clang/test/SemaCXX/cxx2a-consteval-default-params.cpp
    M clang/test/SemaCXX/source_location.cpp

  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