[clang] [clang] Output an error when [[lifetimebound]] attribute is applied on a function parameter while the function returns void (PR #113460)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 25 02:29:29 PDT 2024


================
@@ -31,6 +32,11 @@ namespace usage_ok {
     return *(int*)param;
   }
 
+  template <class T, class R = void> R dependent_void(const T& t [[clang::lifetimebound]]);
+  void dependent_void_instantiation() {
+    dependent_void<int>(1);
----------------
usx95 wrote:

nit: add the following for completeness.
```
int x = dependent_void<int, int>(1); // warning.
dependent_void<int, int>(1); // Ok.
```

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


More information about the cfe-commits mailing list