[all-commits] [llvm/llvm-project] 9b4faa: [clang] Fix overly aggressive lifetime checks for ...
Alan Zhao via All-commits
all-commits at lists.llvm.org
Mon May 1 10:02:31 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 9b4faa11c68be4b45ddf29acd575bb52a3c2fad7
https://github.com/llvm/llvm-project/commit/9b4faa11c68be4b45ddf29acd575bb52a3c2fad7
Author: Alan Zhao <ayzhao at google.com>
Date: 2023-05-01 (Mon, 01 May 2023)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/include/clang/Sema/Initialization.h
M clang/lib/Sema/SemaAccess.cpp
M clang/lib/Sema/SemaInit.cpp
M clang/test/CodeGen/paren-list-agg-init.cpp
M clang/test/SemaCXX/paren-list-agg-init.cpp
Log Message:
-----------
[clang] Fix overly aggressive lifetime checks for parenthesized aggregate initialization
Before this patch, initialized class members would have the LifetimeKind
LK_MemInitializer, which does not allow for binding a temporary to a
reference. Binding to a temporary however is allowed in parenthesized
aggregate initialization, even if it leads to a dangling reference. To
fix this, we create a new EntityKind, EK_ParenAggInitMember, which has
LifetimeKind LK_FullExpression.
This patch does *not* attempt to diagnose dangling references as a
result of using this feature.
This patch also refactors TryOrBuildParenListInitialization(...) to
accomodate creating different InitializedEntity objects.
Fixes #61567
[0]: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0960r3.html
Reviewed By: shafik
Differential Revision: https://reviews.llvm.org/D148274
More information about the All-commits
mailing list