[all-commits] [llvm/llvm-project] 83c90e: [clang] Fix consteval initializers of temporaries

Mariya Podchishchaeva via All-commits all-commits at lists.llvm.org
Tue Mar 28 04:42:26 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 83c90e623a308a6313783f320eeaabc7e3f9f4b2
  Author: Mariya Podchishchaeva <mariya.podchishchaeva at intel.com>
  Date:   2023-03-28 (Tue, 28 Mar 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Sema/SemaExprCXX.cpp
    M clang/test/SemaCXX/cxx2a-consteval.cpp

  Log Message:
  [clang] Fix consteval initializers of temporaries

When a potential immediate invocation is met, it is immediately wrapped by a
`ConstantExpr`. There is also a TreeTransform that removes this `ConstantExpr`
wrapper when corresponding expression evaluation context is popped.
So, in case initializer was an immediate invocation, `CXXTemporaryObjectExpr`
was wrapped by a `ConstantExpr`, and that caused additional unnecessary
`CXXFunctionalCastExpr` to be added, which later confused the TreeTransform
that rebuilds immediate invocations, so it was adding unnecessary
constructor call.

Fixes https://github.com/llvm/llvm-project/issues/60286

Reviewed By: aaron.ballman

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

More information about the All-commits mailing list