[libcxx-commits] [libcxx] [libc++][NFC] Fix unparenthesized comma expression in mem-initializer (PR #89605)

Krystian Stasiowski via libcxx-commits libcxx-commits at lists.llvm.org
Mon Apr 22 06:36:31 PDT 2024


https://github.com/sdkrystian created https://github.com/llvm/llvm-project/pull/89605

#84050 resolves class member access expressions naming members of the current instantiation prior to instantiation. In testing, it has revealed a mem-initializer in the move constructor of `invocable_with_telemetry` that uses an unparenthesized comma expression to initialize a non-static data member of pointer type. This patch fixes it. 


>From 202f373e597989855f0544812f0dc22d102c0e21 Mon Sep 17 00:00:00 2001
From: Krystian Stasiowski <sdkrystian at gmail.com>
Date: Mon, 22 Apr 2024 09:31:26 -0400
Subject: [PATCH] [libc++][NFC] Fix unparenthesized expression in
 mem-initializer

---
 libcxx/test/support/invocable_with_telemetry.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcxx/test/support/invocable_with_telemetry.h b/libcxx/test/support/invocable_with_telemetry.h
index 612bbec639d466..e010837a1624cd 100644
--- a/libcxx/test/support/invocable_with_telemetry.h
+++ b/libcxx/test/support/invocable_with_telemetry.h
@@ -31,7 +31,7 @@ class invocable_with_telemetry {
   constexpr invocable_with_telemetry(invocable_with_telemetry&& other)
     requires std::move_constructible<F>
       : f_(std::move(other.f_)),
-        telemetry_(assert(other.telemetry_ != nullptr), std::exchange(other.telemetry_, nullptr)) {
+        telemetry_((assert(other.telemetry_ != nullptr), std::exchange(other.telemetry_, nullptr))) {
     ++telemetry_->moves;
   }
 



More information about the libcxx-commits mailing list