public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [committed] libstdc++: Fix test that fails with -ffreestanding
Date: Sat, 11 Nov 2023 00:44:54 +0000	[thread overview]
Message-ID: <20231111004458.78235-1-jwakely@redhat.com> (raw)

Tested x86_64-linux. Pushed to trunk.

-- >8 --

The -ffreestanding option disables Debug Mode, forcibly #undef'ing
_GLIBCXX_DEBUG. This means that the dangling checks in std::pair are
disabled for -ffreestanding in C++17 and earlier, because they depend on
_GLIBCXX_DEBUG. Adjust the target specifiers for the errors currently
matching c++17_down so they also require the hosted effective target.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/pair/dangling_ref.cc: Add hosted effective
	target for specifiers using c++17_down.
---
 .../testsuite/20_util/pair/dangling_ref.cc    | 20 +++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/libstdc++-v3/testsuite/20_util/pair/dangling_ref.cc b/libstdc++-v3/testsuite/20_util/pair/dangling_ref.cc
index 8e0c34816dd..ca238f9cbd1 100644
--- a/libstdc++-v3/testsuite/20_util/pair/dangling_ref.cc
+++ b/libstdc++-v3/testsuite/20_util/pair/dangling_ref.cc
@@ -22,15 +22,15 @@ void
 test_binary_ctors()
 {
   std::pair<const int&, int> p1(1L, 2);
-  // { dg-error "here" "" { target c++17_down } 24 }
+  // { dg-error "here" "" { target { c++17_down && hosted } } 24 }
   // { dg-error "use of deleted function" "" { target c++20 } 24 }
 
   std::pair<int, const int&> p2(1, 2L);
-  // { dg-error "here" "" { target c++17_down } 28 }
+  // { dg-error "here" "" { target { c++17_down && hosted } } 28 }
   // { dg-error "use of deleted function" "" { target c++20 } 28 }
 
   std::pair<const int&, const int&> p3(1L, 2L);
-  // { dg-error "here" "" { target c++17_down } 32 }
+  // { dg-error "here" "" { target { c++17_down && hosted } } 32 }
   // { dg-error "use of deleted function" "" { target c++20 } 32 }
 }
 
@@ -40,28 +40,28 @@ test_converting_ctors()
   std::pair<long, long> p0;
 
   std::pair<const int&, int> p1(p0);
-  // { dg-error "here" "" { target c++17_down } 42 }
+  // { dg-error "here" "" { target { c++17_down && hosted } } 42 }
   // { dg-error "use of deleted function" "" { target c++20 } 42 }
 
   std::pair<int, const int&> p2(p0);
-  // { dg-error "here" "" { target c++17_down } 46 }
+  // { dg-error "here" "" { target { c++17_down && hosted } } 46 }
   // { dg-error "use of deleted function" "" { target c++20 } 46 }
 
   std::pair<const int&, const int&> p3(p0);
-  // { dg-error "here" "" { target c++17_down } 50 }
+  // { dg-error "here" "" { target { c++17_down && hosted } } 50 }
   // { dg-error "use of deleted function" "" { target c++20 } 50 }
 
   std::pair<const int&, int> p4(std::move(p0));
-  // { dg-error "here" "" { target c++17_down } 54 }
+  // { dg-error "here" "" { target { c++17_down && hosted } } 54 }
   // { dg-error "use of deleted function" "" { target c++20 } 54 }
 
   std::pair<int, const int&> p5(std::move(p0));
-  // { dg-error "here" "" { target c++17_down } 58 }
+  // { dg-error "here" "" { target { c++17_down && hosted } } 58 }
   // { dg-error "use of deleted function" "" { target c++20 } 58 }
 
   std::pair<const int&, const int&> p6(std::move(p0));
-  // { dg-error "here" "" { target c++17_down } 62 }
+  // { dg-error "here" "" { target { c++17_down && hosted } } 62 }
   // { dg-error "use of deleted function" "" { target c++20 } 62 }
 }
 
-// { dg-error "static assert.* dangling reference" "" { target { c++17_down } } 0 }
+// { dg-error "static assert.* dangling reference" "" { target { c++17_down && hosted } } 0 }
-- 
2.41.0


                 reply	other threads:[~2023-11-11  0:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231111004458.78235-1-jwakely@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).