[clang] [clang] Update the lifetimebound example with up-to-date expected warning and change the sample code to be a fully working example (PR #113437)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 29 16:08:10 PDT 2024


================
@@ -3702,20 +3702,32 @@ user-declared functions. For example:
 
 .. code-block:: c++
 
+    #include <map>
+    #include <string>
+
+    using namespace std::literals;
+
     // Returns m[key] if key is present, or default_value if not.
     template<typename T, typename U>
     const U &get_or_default(const std::map<T, U> &m [[clang::lifetimebound]],
----------------
shafik wrote:

We don't need the `[[clang::lifetimebound]]` on `m` for this example, do we?

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


More information about the cfe-commits mailing list