[llvm] [ADT] Fix a minor build error (PR #104840)

Dmitry Yanovsky via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 19 12:50:24 PDT 2024


================
@@ -316,7 +316,7 @@ TEST(UniqueFunctionTest, InlineStorageWorks) {
   // We do assume a couple of implementation details of the unique_function here:
   //  - It can store certain small-enough payload inline
   //  - Inline storage size is at least >= sizeof(void*)
-  void *ptr;
+  void *ptr = nullptr;
   unique_function<void(void *)> UniqueFunctionWithInlineStorage{
       [ptr](void *self) {
----------------
kerambyte wrote:

In this case we just need to store _something_ in the lambda so we can then get the address of it. Capturing `ptr` by reference here won't really work since we'll be getting the address of the stack variable in this case.

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


More information about the llvm-commits mailing list