public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] libstdc++: Fix test that fails in C++20 mode [PR 99995]
@ 2021-04-12 10:35 Jonathan Wakely
  2021-04-12 11:31 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Wakely @ 2021-04-12 10:35 UTC (permalink / raw)
  To: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 622 bytes --]

The 17_intro/headers/c++1998/49745.cc test fails for C++20 mode with PCH
enabled, because PCH makes it include <bits/stdc++.h>, which includes
<atomic>, and that includes <unistd.h> in C++20 mode. The <unistd.h>
dependency should go away when C++20 atomic waiting is stable, but will
probably remain while the feature is experimental. Change the test to
always include <bits/stdc++.h>, and XFAIL for C++20 and later.

libstdc++-v3/ChangeLog:

	PR libstdc++/99995
	* testsuite/17_intro/headers/c++1998/49745.cc: Include all
	standard headers and XFAIL for effective-target c++20.

Tested x86_64-linux. Committed to trunk.


[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1329 bytes --]

commit 29046e02b84a16b6315d952d7f76c502d0d021c2
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Apr 12 11:12:47 2021

    libstdc++: Fix test that fails in C++20 mode [PR 99995]
    
    The 17_intro/headers/c++1998/49745.cc test fails for C++20 mode with PCH
    enabled, because PCH makes it include <bits/stdc++.h>, which includes
    <atomic>, and that includes <unistd.h> in C++20 mode. The <unistd.h>
    dependency should go away when C++20 atomic waiting is stable, but will
    probably remain while the feature is experimental. Change the test to
    always include <bits/stdc++.h>, and XFAIL for C++20 and later.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/99995
            * testsuite/17_intro/headers/c++1998/49745.cc: Include all
            standard headers and XFAIL for effective-target c++20.

diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++1998/49745.cc b/libstdc++-v3/testsuite/17_intro/headers/c++1998/49745.cc
index a13a40ec7db..204975e0316 100644
--- a/libstdc++-v3/testsuite/17_intro/headers/c++1998/49745.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++1998/49745.cc
@@ -18,5 +18,7 @@
 // <http://www.gnu.org/licenses/>.
 
 // libstdc++/49745
-#include <iostream>
+#include <bits/stdc++.h>
 int truncate = 0;
+
+// { dg-xfail-if "PR libstdc++/99995" { c++20 } }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [committed] libstdc++: Fix test that fails in C++20 mode [PR 99995]
  2021-04-12 10:35 [committed] libstdc++: Fix test that fails in C++20 mode [PR 99995] Jonathan Wakely
@ 2021-04-12 11:31 ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2021-04-12 11:31 UTC (permalink / raw)
  To: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 105 bytes --]

And this one fixes a couple more tests that fail with C++20.

Tested x86_64-linux. Committed to trunk.



[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 2541 bytes --]

commit 91dd7954c44b201aa3b16e66b18d7a5df00fded9
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Apr 12 11:45:21 2021

    libstdc++: Fix some tests that fail in C++20 mode
    
    The linear_congruential_engine negative tests fail with a different
    error in C++20 mode, because double is no longer an invalid type for
    NTTP. Adjust the expected errors.
    
    libstdc++-v3/ChangeLog:
    
            * testsuite/26_numerics/random/linear_congruential_engine/requirements/non_uint_neg.cc:
            Adjust expected error for C++20 mode.
            * testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/non_uint_neg.cc:
            Likewise.

diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/non_uint_neg.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/non_uint_neg.cc
index e04e8ca6972..a36d63c6c7b 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/non_uint_neg.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/non_uint_neg.cc
@@ -20,10 +20,12 @@
 
 // { dg-do compile { target c++11 } }
 // { dg-require-cstdint "" }
+// { dg-error "not a valid type" "" { target { ! c++20 } } 31 }
+// { dg-error "from 'int' to 'double'" "" { target c++20 } 31 }
 
 // 26.4.3.1 class template linear_congruential_engine [rand.eng.lcong]
 // 26.4.2.2 Concept RandomNumberEngine [rand.concept.eng]
 
 #include <random>
 
-std::linear_congruential_engine<double, 48271, 0, 2147483647> x; // { dg-error "not a valid type" }
+std::linear_congruential_engine<double, 48271, 0, 2147483647> x;
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/non_uint_neg.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/non_uint_neg.cc
index 5ad82db1def..53b15f32516 100644
--- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/non_uint_neg.cc
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/non_uint_neg.cc
@@ -19,7 +19,8 @@
 
 // { dg-do compile }
 // { dg-options "-D_GLIBCXX_CONCEPT_CHECKS" }
-// { dg-error "not a valid type" "" { target *-*-* } 29 }
+// { dg-error "not a valid type" "" { target { ! c++20 } } 30 }
+// { dg-error "from 'int' to 'double'" "" { target c++20 } 30 }
 
 // 5.1.4.1 class template linear_congruential [tr.rand.eng.lcong]
 // 5.1.4.1 [4]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-12 11:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12 10:35 [committed] libstdc++: Fix test that fails in C++20 mode [PR 99995] Jonathan Wakely
2021-04-12 11:31 ` Jonathan Wakely

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).