[all-commits] [llvm/llvm-project] 26baa0: [clang] Diagnose dangling references for parenthes...
Haojian Wu via All-commits
all-commits at lists.llvm.org
Fri Nov 29 01:15:41 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 26baa00908b2eb8b2925800af6bc64fbe53cac48
https://github.com/llvm/llvm-project/commit/26baa00908b2eb8b2925800af6bc64fbe53cac48
Author: Haojian Wu <hokein.wu at gmail.com>
Date: 2024-11-29 (Fri, 29 Nov 2024)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/lib/Sema/CheckExprLifetime.cpp
M clang/test/AST/ByteCode/records.cpp
A clang/test/SemaCXX/cxx20-warn-dangling-paren-list-agg-init.cpp
M clang/test/SemaCXX/paren-list-agg-init.cpp
Log Message:
-----------
[clang] Diagnose dangling references for parenthesized aggregate initialization. (#117690)
Unlike brace initialization, the parenthesized aggregate initialization
in C++20 does not extend the lifetime of a temporary object bound to a
reference in an aggreate. This can lead to dangling references:
```
struct A { const int& r; };
A a1(1); // well-formed, but results in a dangling reference.
```
With this patch, clang will diagnose this common dangling issues.
Fixes #101957
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list