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

Dmitry Yanovsky via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 19 12:56:29 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:

Indeed, but it is impossible to get an address of a reference variable in C++ AFAIK, so we won't be able to use it for the test below? Doing `&ptr` will return the address of original object. Unless I'm misunderstanding what you're suggesting in which case I apologize for not getting that.

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


More information about the llvm-commits mailing list