[libcxx-commits] [libcxx] [libcxx] Remove empty ~__no_destroy (PR #89882)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 25 06:47:22 PDT 2024


================
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include <__utility/no_destroy.h>
+#include <cassert>
+
+#include "test_macros.h"
+
+struct DestroyLast {
+  ~DestroyLast() { assert(*ptr == 5); }
+
+  int* ptr;
+} last;
+
+static std::__no_destroy<int> nd_int(5);
+
+void test() { last.ptr = &nd_int.__get(); }
----------------
ldionne wrote:

We could just inline that function into `main`.

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


More information about the libcxx-commits mailing list