[libcxx-commits] [libcxx] [libcxx] implement LWG4148: unique_ptr::operator* should not allow dangling references (PR #128213)

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Fri Feb 21 11:08:07 PST 2025


================
@@ -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
+//
+//===----------------------------------------------------------------------===//
----------------
mordante wrote:

We tend to prefer to use `unique_ptr.verify.cpp` and then test whether tests fail for the expected reason.

This file has a nice example of a verify test for a `static_assert`, where "cannot fill zero-sized array of type 'const T'" is the message of the `static_assert`
https://github.com/llvm/llvm-project/blob/main/libcxx/test/std/containers/sequences/array/array.fill/fill.verify.cpp

I think you can omit the ` // expected-note {{requested here}}` part.



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


More information about the libcxx-commits mailing list