[libcxx-commits] [libcxx] Add a regression test for recent regression in pair. (PR #97355)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jul 1 14:50:01 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: James Y Knight (jyknight)

<details>
<summary>Changes</summary>

PR #<!-- -->96165 broke code similar to this test, and was subsequently reverted. Add a test-case, to ensure the problem won't reoccur.

---
Full diff: https://github.com/llvm/llvm-project/pull/97355.diff


1 Files Affected:

- (added) libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/pair.incomplete.verify.cpp (+15) 


``````````diff
diff --git a/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/pair.incomplete.verify.cpp b/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/pair.incomplete.verify.cpp
new file mode 100644
index 0000000000000..d0832ea311690
--- /dev/null
+++ b/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/pair.incomplete.verify.cpp
@@ -0,0 +1,15 @@
+// Check that instantiating pair doesn't look up type traits "too early", before
+// the contained types have been completed.
+//
+// This is a regression test, to prevent a reoccurrance of the issue introduced in
+// 5e1de27f680591a870d78e9952b23f76aed7f456.
+
+// expected-no-diagnostics
+#include <utility>
+#include <vector>
+
+struct Test {
+  std::vector<std::pair<int, Test>> v;
+};
+
+std::pair<int, Test> p;

``````````

</details>


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


More information about the libcxx-commits mailing list