diff --git a/libstdc++-v3/testsuite/18_support/set_terminate.cc b/libstdc++-v3/testsuite/18_support/set_terminate.cc
index 4df6e068f583..b832f30a365a 100644
--- a/libstdc++-v3/testsuite/18_support/set_terminate.cc
+++ b/libstdc++-v3/testsuite/18_support/set_terminate.cc
@@ -16,7 +16,7 @@
// .
// { dg-options "-std=gnu++11" }
-// { dg-do run }
+// { dg-do run { target c++11 } }
#include
#include
diff --git a/libstdc++-v3/testsuite/24_iterators/headers/iterator/synopsis.cc b/libstdc++-v3/testsuite/24_iterators/headers/iterator/synopsis.cc
index e0b364c38346..53bd9c9891c7 100644
--- a/libstdc++-v3/testsuite/24_iterators/headers/iterator/synopsis.cc
+++ b/libstdc++-v3/testsuite/24_iterators/headers/iterator/synopsis.cc
@@ -1,5 +1,5 @@
// { dg-options "-std=gnu++98" }
-// { dg-do compile }
+// { dg-do compile { target { ! c++17 } } }
// { dg-require-normal-namespace "" }
// Copyright (C) 2007-2020 Free Software Foundation, Inc.
diff --git a/libstdc++-v3/testsuite/28_regex/simple_c++11.cc b/libstdc++-v3/testsuite/28_regex/simple_c++11.cc
index 056966b238f9..8b3fda5c98da 100644
--- a/libstdc++-v3/testsuite/28_regex/simple_c++11.cc
+++ b/libstdc++-v3/testsuite/28_regex/simple_c++11.cc
@@ -16,7 +16,7 @@
// .
// { dg-options "-std=gnu++11" }
-// { dg-do compile }
+// { dg-do compile { target c++11 } }
#include
diff --git a/libstdc++-v3/testsuite/tr1/headers/c++200x/complex.cc b/libstdc++-v3/testsuite/tr1/headers/c++200x/complex.cc
index 9eb9d33301c3..652b534cd69a 100644
--- a/libstdc++-v3/testsuite/tr1/headers/c++200x/complex.cc
+++ b/libstdc++-v3/testsuite/tr1/headers/c++200x/complex.cc
@@ -1,5 +1,5 @@
-// { dg-do compile }
// { dg-options "-std=gnu++11" }
+// { dg-do compile { target c++11 } }
// Copyright (C) 2011-2020 Free Software Foundation, Inc.
//