[libcxx] [llvm] Add C++23 stacktrace (P0881R7) (PR #136528)

Hristo Hristov via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 21 11:40:41 PDT 2025


================
@@ -0,0 +1,106 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <stacktrace>
+
+#include <cassert>
+
+/*
+  (19.6.4.4) Comparisons [stacktrace.basic.cmp]
+
+  template<class Allocator2>
+  friend bool operator==(const basic_stacktrace& x,
+                          const basic_stacktrace<Allocator2>& y) noexcept;
+
+  template<class Allocator2>
+  friend strong_ordering operator<=>(const basic_stacktrace& x,
+                                      const basic_stacktrace<Allocator2>& y) noexcept;
+*/
----------------
Zingam wrote:

I think the current practice is to test a single function, method in a test, e.g.

stacktrace/basic.cmp/equality.pass.pass for `operator==`
stacktrace/basic.cmp/three_way_comparison.pass.cpp for spaceship

you need to put the tests in subdirectories named after the C++ standard sections

Then add the synopsis and then the includes sorted.

```suggestion

// template<class Allocator>
//  class basic_stacktrace

//  template<class Allocator2>
//  friend bool operator==(const basic_stacktrace& x,
//                          const basic_stacktrace<Allocator2>& y) noexcept;


#include <cassert>
#include <stacktrace>
```

Did you have a test for `noexcept`?

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


More information about the llvm-commits mailing list