From: Jonathan Wakely Date: Tue, 11 May 2021 16:14:26 +0000 (+0100) Subject: libstdc++: Fix tests that fail in C++98 mode X-Git-Tag: upstream/12.2.0~7973 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=37407a2ae701c0a93377106a2938ab5474062fc3;p=platform%2Fupstream%2Fgcc.git 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 --git a/libstdc++-v3/testsuite/20_util/headers/memory/synopsis.cc b/libstdc++-v3/testsuite/20_util/headers/memory/synopsis.cc index 1463fcf..9a4264a 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 d5f7a5d..e070fb9 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 diff --git a/libstdc++-v3/testsuite/25_algorithms/copy/debug/99402.cc b/libstdc++-v3/testsuite/25_algorithms/copy/debug/99402.cc index 041d222..9a9c97a 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 source = { 0, 1 }; + const set source(two, two + 2); vector dest(1); copy(source.begin(), ++source.begin(), dest.begin()); }