public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r12-724] libstdc++: Fix tests that fail in C++98 mode
Date: Tue, 11 May 2021 16:33:05 +0000 (GMT)	[thread overview]
Message-ID: <20210511163305.2D126388CC03@sourceware.org> (raw)

https://gcc.gnu.org/g:37407a2ae701c0a93377106a2938ab5474062fc3

commit r12-724-g37407a2ae701c0a93377106a2938ab5474062fc3
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue May 11 17:14:26 2021 +0100

    libstdc++: Fix tests that fail in C++98 mode
    
    The header synopsis test fails to define NOTHROW for C++98.
    
    The shared_ptr test should be skipped for C++98.
    
    The debug mode one should work for C++98 too, it just needs to avoid
    C++11 syntax that isn't valid in C++98.
    
    libstdc++-v3/ChangeLog:
    
            * testsuite/20_util/headers/memory/synopsis.cc: Define C++98
            alternative for macro.
            * testsuite/20_util/shared_ptr/creation/99006.cc: Add effective
            target keyword.
            * testsuite/25_algorithms/copy/debug/99402.cc: Avoid C++11
            syntax.

Diff:
---
 libstdc++-v3/testsuite/20_util/headers/memory/synopsis.cc   | 2 ++
 libstdc++-v3/testsuite/20_util/shared_ptr/creation/99006.cc | 4 ++--
 libstdc++-v3/testsuite/25_algorithms/copy/debug/99402.cc    | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/libstdc++-v3/testsuite/20_util/headers/memory/synopsis.cc b/libstdc++-v3/testsuite/20_util/headers/memory/synopsis.cc
index 1463fcf9468..9a4264a0759 100644
--- a/libstdc++-v3/testsuite/20_util/headers/memory/synopsis.cc
+++ b/libstdc++-v3/testsuite/20_util/headers/memory/synopsis.cc
@@ -22,6 +22,8 @@
 
 #if __cplusplus >= 201103L
 # define NOTHROW noexcept
+#else
+# define NOTHROW
 #endif
 
 namespace std {
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/creation/99006.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/creation/99006.cc
index d5f7a5da5e9..e070fb9d420 100644
--- a/libstdc++-v3/testsuite/20_util/shared_ptr/creation/99006.cc
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/creation/99006.cc
@@ -1,5 +1,5 @@
-// FIXME: This should use { target { ! c++20 } }
-// { dg-do compile }
+// FIXME: This should use { target { c++11 && { ! c++20 } } }
+// { dg-do compile { target { c++11 } } }
 
 #include <memory>
 
diff --git a/libstdc++-v3/testsuite/25_algorithms/copy/debug/99402.cc b/libstdc++-v3/testsuite/25_algorithms/copy/debug/99402.cc
index 041d222d079..9a9c97af605 100644
--- a/libstdc++-v3/testsuite/25_algorithms/copy/debug/99402.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/copy/debug/99402.cc
@@ -28,8 +28,9 @@ using namespace std;
 
 int main()
 {
+    int two[] = { 0, 1 };
     // any container with non-random access iterators:
-    const set<int> source = { 0, 1 };
+    const set<int> source(two, two + 2);
     vector<int> dest(1);
     copy(source.begin(), ++source.begin(), dest.begin());
 }


                 reply	other threads:[~2021-05-11 16:33 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=20210511163305.2D126388CC03@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@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).