public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix libstdc++ testsuite failures in C++11 mode
@ 2017-01-26 20:00 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2017-01-26 20:00 UTC (permalink / raw)
  To: libstdc++, gcc-patches

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

We have FAILs in two tests that use { target c++11 } but don't
actually compile in C++11 mode. One because default member
initializers make the type a non-aggregate so it can't be
list-initialized and one because it uses std::less<>.

There are also some tests for container adaptors which should not run
in C++98 mode.

Tested powerpc64le-linux, as c++{98,11,14,17}.

Committed to trunk.


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

commit 9f9126522107fddfa45f9b9cc258c5c2ba3891eb
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Jan 26 18:33:27 2017 +0000

    Fix libstdc++ testsuite failures in C++98 and C++11 mode
    
    	* testsuite/23_containers/list/operations/78389.cc: Fix for C++11
    	mode.
    	* testsuite/23_containers/priority_queue/requirements/constructible.cc:
    	Mark as unsupported in C++98 mode.
    	* testsuite/23_containers/queue/requirements/constructible.cc:
    	Likewise.
    	* testsuite/23_containers/stack/requirements/constructible.cc:
    	Likewise.
    	* testsuite/25_algorithms/make_heap/movable.cc: Fix for C++11 mode.

diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/78389.cc b/libstdc++-v3/testsuite/23_containers/list/operations/78389.cc
index 4d8b7d2..e0cc6e6 100644
--- a/libstdc++-v3/testsuite/23_containers/list/operations/78389.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/78389.cc
@@ -19,19 +19,19 @@
 
 // 23.2.2.4 list operations [lib.list.ops]
 
-#include <testsuite_hooks.h>
-
 #include <list>
+#include <testsuite_hooks.h>
 
 struct ThrowingComparator
 {
-  unsigned int throw_after = 0;
-  unsigned int count = 0;
+  ThrowingComparator(unsigned n) : throw_after(n), count(0) { }
+  unsigned int throw_after;
+  unsigned int count;
   bool operator()(int, int) {
     if (++count >= throw_after) {
       throw 666;
     }
-    return true;
+    return false;
   }
 };
 
diff --git a/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/constructible.cc b/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/constructible.cc
index fa412f3..b03af48 100644
--- a/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/constructible.cc
+++ b/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/constructible.cc
@@ -1,4 +1,4 @@
-// { dg-do compile }
+// { dg-do compile { target c++11 } }
 
 // Copyright (C) 2017 Free Software Foundation, Inc.
 //
diff --git a/libstdc++-v3/testsuite/23_containers/queue/requirements/constructible.cc b/libstdc++-v3/testsuite/23_containers/queue/requirements/constructible.cc
index 99a8b84..5f2bf30 100644
--- a/libstdc++-v3/testsuite/23_containers/queue/requirements/constructible.cc
+++ b/libstdc++-v3/testsuite/23_containers/queue/requirements/constructible.cc
@@ -1,4 +1,4 @@
-// { dg-do compile }
+// { dg-do compile { target c++11 } }
 
 // Copyright (C) 2017 Free Software Foundation, Inc.
 //
diff --git a/libstdc++-v3/testsuite/23_containers/stack/requirements/constructible.cc b/libstdc++-v3/testsuite/23_containers/stack/requirements/constructible.cc
index 0d6e174..76785be 100644
--- a/libstdc++-v3/testsuite/23_containers/stack/requirements/constructible.cc
+++ b/libstdc++-v3/testsuite/23_containers/stack/requirements/constructible.cc
@@ -1,4 +1,4 @@
-// { dg-do compile }
+// { dg-do compile { target c++11 } }
 
 // Copyright (C) 2017 Free Software Foundation, Inc.
 //
diff --git a/libstdc++-v3/testsuite/25_algorithms/make_heap/movable.cc b/libstdc++-v3/testsuite/25_algorithms/make_heap/movable.cc
index f6738f1..7d34ff2 100644
--- a/libstdc++-v3/testsuite/25_algorithms/make_heap/movable.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/make_heap/movable.cc
@@ -25,7 +25,7 @@ void
 test01()
 {
   int i[] = { 1, 2, 3, 4 };
-  std::function<bool(int, int)> f = std::less<>{};
+  std::function<bool(int, int)> f = std::less<int>{};
   // If this uses a moved-from std::function we'll get an exception:
   std::make_heap(std::begin(i), std::end(i), f);
   std::sort_heap(std::begin(i), std::end(i), f);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-01-26 19:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-26 20:00 [PATCH] Fix libstdc++ testsuite failures in C++11 mode 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).