diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/erasure.cc b/libstdc++-v3/testsuite/21_strings/basic_string/erasure.cc
index 6e475cf40bc..f36562a3f19 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/erasure.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/erasure.cc
@@ -21,6 +21,12 @@
 #include <string>
 #include <testsuite_hooks.h>
 
+#ifndef __cpp_lib_erase_if
+# error "Feature-test macro for erase_if missing in <string>"
+#elif __cpp_lib_erase_if < 202002
+# error "Feature-test macro for erase_if has wrong value in <string>"
+#endif
+
 void
 test01()
 {
diff --git a/libstdc++-v3/testsuite/23_containers/deque/erasure.cc b/libstdc++-v3/testsuite/23_containers/deque/erasure.cc
index 328e2fdbefa..8bd0206c890 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/erasure.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/erasure.cc
@@ -22,9 +22,9 @@
 #include <testsuite_hooks.h>
 
 #ifndef __cpp_lib_erase_if
-# error "Feature-test macro for erase_if missing"
+# error "Feature-test macro for erase_if missing in <deque>"
 #elif __cpp_lib_erase_if < 202002
-# error "Feature-test macro for erase_if has wrong value"
+# error "Feature-test macro for erase_if has wrong value in <deque>"
 #endif
 
 void
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/erasure.cc b/libstdc++-v3/testsuite/23_containers/forward_list/erasure.cc
index ce321cf0c59..133dc3a699b 100644
--- a/libstdc++-v3/testsuite/23_containers/forward_list/erasure.cc
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/erasure.cc
@@ -22,9 +22,9 @@
 #include <testsuite_hooks.h>
 
 #ifndef __cpp_lib_erase_if
-# error "Feature-test macro for erase_if missing"
+# error "Feature-test macro for erase_if missing in <forward_list>"
 #elif __cpp_lib_erase_if < 202002
-# error "Feature-test macro for erase_if has wrong value"
+# error "Feature-test macro for erase_if has wrong value in <forward_list>"
 #endif
 
 void
diff --git a/libstdc++-v3/testsuite/23_containers/list/erasure.cc b/libstdc++-v3/testsuite/23_containers/list/erasure.cc
index 2b543d2f321..3620342ba9a 100644
--- a/libstdc++-v3/testsuite/23_containers/list/erasure.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/erasure.cc
@@ -22,9 +22,9 @@
 #include <testsuite_hooks.h>
 
 #ifndef __cpp_lib_erase_if
-# error "Feature-test macro for erase_if missing"
+# error "Feature-test macro for erase_if missing in <list>"
 #elif __cpp_lib_erase_if < 202002
-# error "Feature-test macro for erase_if has wrong value"
+# error "Feature-test macro for erase_if has wrong value in <list>"
 #endif
 
 void
diff --git a/libstdc++-v3/testsuite/23_containers/map/erasure.cc b/libstdc++-v3/testsuite/23_containers/map/erasure.cc
index 4575e191267..1bd84813a97 100644
--- a/libstdc++-v3/testsuite/23_containers/map/erasure.cc
+++ b/libstdc++-v3/testsuite/23_containers/map/erasure.cc
@@ -23,9 +23,9 @@
 #include <testsuite_hooks.h>
 
 #ifndef __cpp_lib_erase_if
-# error "Feature-test macro for erase_if missing"
+# error "Feature-test macro for erase_if missing in <map>"
 #elif __cpp_lib_erase_if < 202002
-# error "Feature-test macro for erase_if has wrong value"
+# error "Feature-test macro for erase_if has wrong value in <map>"
 #endif
 
 auto is_odd_pair = [](const std::pair<const int, std::string>& p)
diff --git a/libstdc++-v3/testsuite/23_containers/set/erasure.cc b/libstdc++-v3/testsuite/23_containers/set/erasure.cc
index 48e70db814f..e5cc4a2c949 100644
--- a/libstdc++-v3/testsuite/23_containers/set/erasure.cc
+++ b/libstdc++-v3/testsuite/23_containers/set/erasure.cc
@@ -22,9 +22,9 @@
 #include <testsuite_hooks.h>
 
 #ifndef __cpp_lib_erase_if
-# error "Feature-test macro for erase_if missing"
+# error "Feature-test macro for erase_if missing in <set>"
 #elif __cpp_lib_erase_if < 202002
-# error "Feature-test macro for erase_if has wrong value"
+# error "Feature-test macro for erase_if has wrong value in <set>"
 #endif
 
 auto is_odd = [](const int i) { return i % 2 != 0; };
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/erasure.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/erasure.cc
index a5af7f02d4f..d08510f789c 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_map/erasure.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/erasure.cc
@@ -23,9 +23,9 @@
 #include <testsuite_hooks.h>
 
 #ifndef __cpp_lib_erase_if
-# error "Feature-test macro for erase_if missing"
+# error "Feature-test macro for erase_if missing in <unordered_map>"
 #elif __cpp_lib_erase_if < 202002
-# error "Feature-test macro for erase_if has wrong value"
+# error "Feature-test macro for erase_if has wrong value in <unordered_map>"
 #endif
 
 auto is_odd_pair = [](const std::pair<const int, std::string>& p)
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/erasure.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/erasure.cc
index c129b1bbfd3..bc719d6a1dd 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_set/erasure.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/erasure.cc
@@ -22,9 +22,9 @@
 #include <testsuite_hooks.h>
 
 #ifndef __cpp_lib_erase_if
-# error "Feature-test macro for erase_if missing"
+# error "Feature-test macro for erase_if missing in <unordered_set>"
 #elif __cpp_lib_erase_if < 202002
-# error "Feature-test macro for erase_if has wrong value"
+# error "Feature-test macro for erase_if has wrong value in <unordered_set>"
 #endif
 
 void
diff --git a/libstdc++-v3/testsuite/23_containers/vector/erasure.cc b/libstdc++-v3/testsuite/23_containers/vector/erasure.cc
index c3fb41f576b..548068741d2 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/erasure.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/erasure.cc
@@ -22,9 +22,9 @@
 #include <testsuite_hooks.h>
 
 #ifndef __cpp_lib_erase_if
-# error "Feature-test macro for erase_if missing"
+# error "Feature-test macro for erase_if missing in <vector>"
 #elif __cpp_lib_erase_if < 202002
-# error "Feature-test macro for erase_if has wrong value"
+# error "Feature-test macro for erase_if has wrong value in <vector>"
 #endif
 
 void
