[patch] Fix libstdc++ tests w.r.t PR c++/60786
Jonathan Wakely
jwakely@redhat.com
Tue Apr 15 19:06:00 GMT 2014
G++ accepts these tests but it shouldn't, and clang doesn't, so this
makes them valid C++11.
Tested x86_64-linux, committed to trunk.
-------------- next part --------------
commit f1517e2ae280691724472cbd0f6b31fa98f313d0
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Apr 15 19:39:15 2014 +0100
PR c++/60786
* testsuite/20_util/shared_ptr/requirements/explicit_instantiation/
1.cc: Fix invalid explicit instantiations with unqualified names.
* testsuite/20_util/shared_ptr/requirements/explicit_instantiation/
2.cc: Likweise.
* testsuite/20_util/tuple/53648.cc: Likweise.
* testsuite/20_util/weak_ptr/requirements/explicit_instantiation/1.cc:
Likewise.
* testsuite/20_util/weak_ptr/requirements/explicit_instantiation/2.cc:
Likewise.
* testsuite/23_containers/unordered_map/requirements/
debug_container.cc: Likewise.
* testsuite/23_containers/unordered_map/requirements/
explicit_instantiation/3.cc: Likewise.
* testsuite/23_containers/unordered_multimap/requirements/debug.cc:
Likewise.
* testsuite/23_containers/unordered_multimap/requirements/
explicit_instantiation/3.cc: Likewise.
* testsuite/23_containers/unordered_multiset/requirements/debug.cc:
Likewise.
* testsuite/23_containers/unordered_multiset/requirements/
explicit_instantiation/3.cc: Likewise.
* testsuite/23_containers/unordered_set/requirements/
debug_container.cc: Likewise.
* testsuite/23_containers/unordered_set/requirements/
explicit_instantiation/3.cc: Likewise.
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/explicit_instantiation/1.cc
index 40ebec0..0d81481 100644
--- a/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/explicit_instantiation/1.cc
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/explicit_instantiation/1.cc
@@ -1,4 +1,4 @@
-// { dg-options "-std=gnu++0x" }
+// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2006-2014 Free Software Foundation, Inc.
@@ -24,8 +24,7 @@
#include <testsuite_tr1.h>
using namespace __gnu_test;
-using std::shared_ptr;
-template class shared_ptr<int>;
-template class shared_ptr<void>;
-template class shared_ptr<ClassType>;
-template class shared_ptr<IncompleteClass>;
+template class std::shared_ptr<int>;
+template class std::shared_ptr<void>;
+template class std::shared_ptr<ClassType>;
+template class std::shared_ptr<IncompleteClass>;
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/explicit_instantiation/2.cc
index 148375a..37a0c1d 100644
--- a/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/explicit_instantiation/2.cc
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/explicit_instantiation/2.cc
@@ -1,4 +1,4 @@
-// { dg-options "-std=gnu++0x" }
+// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2007-2014 Free Software Foundation, Inc.
@@ -27,8 +27,7 @@
// library this checks the templates can be instantiated for non-default
// lock policy, for a single-threaded lib this is redundant but harmless.
using namespace __gnu_test;
-using std::__shared_ptr;
using std::_S_single;
-template class __shared_ptr<int, _S_single>;
-template class __shared_ptr<ClassType, _S_single>;
-template class __shared_ptr<IncompleteClass, _S_single>;
+template class std::__shared_ptr<int, _S_single>;
+template class std::__shared_ptr<ClassType, _S_single>;
+template class std::__shared_ptr<IncompleteClass, _S_single>;
diff --git a/libstdc++-v3/testsuite/20_util/tuple/53648.cc b/libstdc++-v3/testsuite/20_util/tuple/53648.cc
index 7bde67e..fb37638 100644
--- a/libstdc++-v3/testsuite/20_util/tuple/53648.cc
+++ b/libstdc++-v3/testsuite/20_util/tuple/53648.cc
@@ -1,4 +1,4 @@
-// { dg-options "-std=gnu++0x" }
+// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2012-2014 Free Software Foundation, Inc.
@@ -27,10 +27,10 @@ using std::tuple;
struct A { };
-template class tuple<tuple<>>;
-template class tuple<tuple<tuple<>>>;
-template class tuple<A, tuple<A, tuple<A, tuple<A>>>>;
-template class tuple<tuple<tuple<A, A>, A>, A>;
+template class std::tuple<tuple<>>;
+template class std::tuple<tuple<tuple<>>>;
+template class std::tuple<A, tuple<A, tuple<A, tuple<A>>>>;
+template class std::tuple<tuple<tuple<A, A>, A>, A>;
// Verify the following QoI properties are preserved
diff --git a/libstdc++-v3/testsuite/20_util/weak_ptr/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/20_util/weak_ptr/requirements/explicit_instantiation/1.cc
index c5a30f2..0a15e46 100644
--- a/libstdc++-v3/testsuite/20_util/weak_ptr/requirements/explicit_instantiation/1.cc
+++ b/libstdc++-v3/testsuite/20_util/weak_ptr/requirements/explicit_instantiation/1.cc
@@ -1,4 +1,4 @@
-// { dg-options "-std=gnu++0x" }
+// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2006-2014 Free Software Foundation, Inc.
@@ -24,8 +24,7 @@
#include <testsuite_tr1.h>
using namespace __gnu_test;
-using std::weak_ptr;
-template class weak_ptr<int>;
-template class weak_ptr<void>;
-template class weak_ptr<ClassType>;
-template class weak_ptr<IncompleteClass>;
+template class std::weak_ptr<int>;
+template class std::weak_ptr<void>;
+template class std::weak_ptr<ClassType>;
+template class std::weak_ptr<IncompleteClass>;
diff --git a/libstdc++-v3/testsuite/20_util/weak_ptr/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/20_util/weak_ptr/requirements/explicit_instantiation/2.cc
index 5c1e91b..c0873a1 100644
--- a/libstdc++-v3/testsuite/20_util/weak_ptr/requirements/explicit_instantiation/2.cc
+++ b/libstdc++-v3/testsuite/20_util/weak_ptr/requirements/explicit_instantiation/2.cc
@@ -1,4 +1,4 @@
-// { dg-options "-std=gnu++0x" }
+// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2007-2014 Free Software Foundation, Inc.
@@ -27,9 +27,8 @@
// library this checks the templates can be instantiated for non-default
// lock policy, for a single-threaded lib this is redundant but harmless.
using namespace __gnu_test;
-using std::__weak_ptr;
using std::_S_single;
-template class __weak_ptr<int, _S_single>;
-template class __weak_ptr<void, _S_single>;
-template class __weak_ptr<ClassType, _S_single>;
-template class __weak_ptr<IncompleteClass, _S_single>;
+template class std::__weak_ptr<int, _S_single>;
+template class std::__weak_ptr<void, _S_single>;
+template class std::__weak_ptr<ClassType, _S_single>;
+template class std::__weak_ptr<IncompleteClass, _S_single>;
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/debug_container.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/debug_container.cc
index abd9d2c..c4d3442 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/debug_container.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/debug_container.cc
@@ -1,4 +1,4 @@
-// { dg-options "-std=gnu++0x" }
+// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2007-2014 Free Software Foundation, Inc.
@@ -21,18 +21,16 @@
#include <string>
#include <debug/unordered_map>
-using namespace __gnu_debug;
-
using std::allocator;
using std::equal_to;
using std::hash;
using std::pair;
using std::string;
-template class unordered_map<string, float>;
-template class unordered_map<string, int,
- hash<string>, equal_to<string>,
- allocator<pair<const string, int> > >;
-template class unordered_map<string, float,
- hash<string>, equal_to<string>,
- allocator<char> >;
+template class __gnu_debug::unordered_map<string, float>;
+template class __gnu_debug::unordered_map<string, int,
+ hash<string>, equal_to<string>,
+ allocator<pair<const string, int>>>;
+template class __gnu_debug::unordered_map<string, float,
+ hash<string>, equal_to<string>,
+ allocator<char>>;
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/3.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/3.cc
index de46c5c..145d23e 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/3.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/3.cc
@@ -1,4 +1,4 @@
-// { dg-options "-std=gnu++0x" }
+// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2007-2014 Free Software Foundation, Inc.
@@ -21,4 +21,5 @@
#include <unordered_map>
using namespace std;
-template class unordered_map<int, int, hash<int>, equal_to<int>, allocator<char>>;
+template class std::unordered_map<int, int, hash<int>, equal_to<int>,
+ allocator<char>>;
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/debug.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/debug.cc
index 488dbe5..d2d7076 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/debug.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/debug.cc
@@ -1,4 +1,4 @@
-// { dg-options "-std=gnu++0x" }
+// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2007-2014 Free Software Foundation, Inc.
@@ -21,8 +21,6 @@
#include <string>
#include <debug/unordered_map>
-using namespace __gnu_debug;
-
using std::string;
-template class unordered_multimap<string, float>;
+template class __gnu_debug::unordered_multimap<string, float>;
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/3.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/3.cc
index e3d0f47..8640bc3 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/3.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/3.cc
@@ -1,4 +1,4 @@
-// { dg-options "-std=gnu++0x" }
+// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2007-2014 Free Software Foundation, Inc.
@@ -21,4 +21,5 @@
#include <unordered_map>
using namespace std;
-template class unordered_multimap<int, int, hash<int>, equal_to<int>, allocator<char>>;
+template class std::unordered_multimap<int, int, hash<int>, equal_to<int>,
+ allocator<char>>;
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/debug.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/debug.cc
index bc35441..5e916ad 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/debug.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/debug.cc
@@ -1,4 +1,4 @@
-// { dg-options "-std=gnu++0x" }
+// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2007-2014 Free Software Foundation, Inc.
@@ -21,6 +21,4 @@
#include <string>
#include <debug/unordered_set>
-using namespace __gnu_debug;
-
-template class unordered_multiset<int>;
+template class __gnu_debug::unordered_multiset<int>;
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/3.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/3.cc
index 2a81347..c4624b5 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/3.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/3.cc
@@ -1,4 +1,4 @@
-// { dg-options "-std=gnu++0x" }
+// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2007-2014 Free Software Foundation, Inc.
@@ -21,4 +21,5 @@
#include <unordered_set>
using namespace std;
-template class unordered_multiset<int, hash<int>, equal_to<int>, allocator<char>>;
+template class std::unordered_multiset<int, hash<int>, equal_to<int>,
+ allocator<char>>;
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/debug_container.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/debug_container.cc
index 948c662..f6ab585 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/debug_container.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/debug_container.cc
@@ -1,4 +1,4 @@
-// { dg-options "-std=gnu++0x" }
+// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2007-2014 Free Software Foundation, Inc.
@@ -20,6 +20,4 @@
#include <debug/unordered_set>
-using namespace __gnu_debug;
-
-template class unordered_set<int>;
+template class __gnu_debug::unordered_set<int>;
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/explicit_instantiation/3.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/explicit_instantiation/3.cc
index 5cdcb3e..27be027 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/explicit_instantiation/3.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/explicit_instantiation/3.cc
@@ -1,4 +1,4 @@
-// { dg-options "-std=gnu++0x" }
+// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2007-2014 Free Software Foundation, Inc.
@@ -21,4 +21,5 @@
#include <unordered_set>
using namespace std;
-template class unordered_set<int, hash<int>, equal_to<int>, allocator<char>>;
+template class std::unordered_set<int, hash<int>, equal_to<int>,
+ allocator<char>>;
More information about the Libstdc++
mailing list