[libcxx-commits] [libcxx] Add a regression test for recent regression in pair. (PR #97355)
James Y Knight via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jul 2 08:13:56 PDT 2024
https://github.com/jyknight updated https://github.com/llvm/llvm-project/pull/97355
>From 832d98196ddd7902311fb12b85667543ca26e537 Mon Sep 17 00:00:00 2001
From: James Y Knight <jyknight at google.com>
Date: Mon, 1 Jul 2024 17:32:11 -0400
Subject: [PATCH 1/3] Add a regression test for recent regression in pair.
PR #96165 broke code similar to this test, and was subsequently
reverted. Add a test-case, to ensure the problem won't reoccur.
---
.../pairs/pairs.pair/pair.incomplete.verify.cpp | 15 +++++++++++++++
1 file changed, 15 insertions(+)
create mode 100644 libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/pair.incomplete.verify.cpp
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;
>From 2c6ed5c9f30bef4274b133c5bc995c4363c6bcb3 Mon Sep 17 00:00:00 2001
From: James Y Knight <jyknight at google.com>
Date: Mon, 1 Jul 2024 19:36:25 -0400
Subject: [PATCH 2/3] Fix syntax for C++03.
---
.../utility/pairs/pairs.pair/pair.incomplete.verify.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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
index d0832ea311690..799e7031cded7 100644
--- 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
@@ -9,7 +9,7 @@
#include <vector>
struct Test {
- std::vector<std::pair<int, Test>> v;
+ std::vector<std::pair<int, Test> > v;
};
std::pair<int, Test> p;
>From 9acc86b1d6de89d8a0a09eedb790dafa10acf9ff Mon Sep 17 00:00:00 2001
From: James Y Knight <jyknight at google.com>
Date: Tue, 2 Jul 2024 11:13:00 -0400
Subject: [PATCH 3/3] Address review comments
---
.../pair.incomplete.compile.pass.cpp | 22 +++++++++++++++++++
.../pairs.pair/pair.incomplete.verify.cpp | 15 -------------
2 files changed, 22 insertions(+), 15 deletions(-)
create mode 100644 libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/pair.incomplete.compile.pass.cpp
delete mode 100644 libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/pair.incomplete.verify.cpp
diff --git a/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/pair.incomplete.compile.pass.cpp b/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/pair.incomplete.compile.pass.cpp
new file mode 100644
index 0000000000000..16ee000cd90fa
--- /dev/null
+++ b/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/pair.incomplete.compile.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// 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.
+
+#include <utility>
+#include <vector>
+
+struct Test {
+ std::vector<std::pair<int, Test> > v;
+};
+
+std::pair<int, Test> p;
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
deleted file mode 100644
index 799e7031cded7..0000000000000
--- a/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/pair.incomplete.verify.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-// 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;
More information about the libcxx-commits
mailing list