[clang] Make [[clang::lifetimebound]] work for expressions coming from default arguments (PR #112047)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 14 09:51:05 PDT 2024


================
@@ -34,13 +38,20 @@ namespace usage_ok {
   struct A {
     A();
     A(int);
+    A(const char*, const int& def3 [[clang::lifetimebound]] = 0); // #def3
     int *class_member() [[clang::lifetimebound]];
     operator int*() [[clang::lifetimebound]];
+    static const int &defaulted_param(const int &def4 [[clang::lifetimebound]] = 0); // #def4
+    static const int &defaulted_param2(const int &def5 [[clang::lifetimebound]] = defaulted_param()); // #def5
----------------
usx95 wrote:

These tests are currently in `namespace usage_ok`.

Can you move to somewhere end of the file under a different namespace like `default_args`

https://github.com/llvm/llvm-project/pull/112047


More information about the cfe-commits mailing list