summaryrefslogtreecommitdiff
path: root/absl/container
diff options
context:
space:
mode:
authorGravatar Derek Mauro <dmauro@google.com>2022-12-02 12:43:54 -0800
committerGravatar Copybara-Service <copybara-worker@google.com>2022-12-02 12:44:43 -0800
commit4e5ff1559ca3bd7bb777a1c48106464cb656e041 (patch)
tree5e76ce7dcf8b18c007dab2a90b1beec59f517df8 /absl/container
parentafcb7de0cfe94ad2ec95dfd0380f74a4b972401c (diff)
Add a compilation test for recursive hash map types
PiperOrigin-RevId: 492535520 Change-Id: I2e58b39bd4ab3064f675474c5e712c76fac02674
Diffstat (limited to 'absl/container')
-rw-r--r--absl/container/flat_hash_map_test.cc8
-rw-r--r--absl/container/node_hash_map_test.cc8
2 files changed, 16 insertions, 0 deletions
diff --git a/absl/container/flat_hash_map_test.cc b/absl/container/flat_hash_map_test.cc
index 263951f1..03171f6d 100644
--- a/absl/container/flat_hash_map_test.cc
+++ b/absl/container/flat_hash_map_test.cc
@@ -311,6 +311,14 @@ TEST(FlatHashMap, Reserve) {
}
}
+TEST(FlatHashMap, RecursiveTypeCompiles) {
+ struct RecursiveType {
+ flat_hash_map<int, RecursiveType> m;
+ };
+ RecursiveType t;
+ t.m[0] = RecursiveType{};
+}
+
} // namespace
} // namespace container_internal
ABSL_NAMESPACE_END
diff --git a/absl/container/node_hash_map_test.cc b/absl/container/node_hash_map_test.cc
index e941a836..9bcf470c 100644
--- a/absl/container/node_hash_map_test.cc
+++ b/absl/container/node_hash_map_test.cc
@@ -272,6 +272,14 @@ TEST(NodeHashMap, NodeHandleMutableKeyAccess) {
}
#endif
+TEST(NodeHashMap, RecursiveTypeCompiles) {
+ struct RecursiveType {
+ node_hash_map<int, RecursiveType> m;
+ };
+ RecursiveType t;
+ t.m[0] = RecursiveType{};
+}
+
} // namespace
} // namespace container_internal
ABSL_NAMESPACE_END