[clang] Make [[clang::lifetimebound]] work for expressions coming from default arguments (PR #112047)
Boaz Brickner via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 14 23:26:22 PDT 2024
================
@@ -107,6 +107,39 @@ namespace std {
using std::operator""s;
using std::operator""sv;
+namespace default_args {
+ using IntArray = int[];
+ const int *defaultparam1(const int &def1 [[clang::lifetimebound]] = 0); // #def1
+ const int &defaultparam_array([[clang::lifetimebound]] const int *p = IntArray{1, 2, 3}); // #def2
+ struct A {
+ A(const char*, const int& def3 [[clang::lifetimebound]] = 0); // #def3
+ };
+ const int &defaultparam2(const int &def4 [[clang::lifetimebound]] = 0); // #def4
+ const int &defaultparam3(const int &def5 [[clang::lifetimebound]] = defaultparam2()); // #def5
+ std::string_view defaultparam4(std::string_view s [[clang::lifetimebound]] = std::string()); // #def6
+
+ const int*test_default_args() {
----------------
bricknerb wrote:
Missing space before *
https://github.com/llvm/llvm-project/pull/112047
More information about the cfe-commits
mailing list