aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Voutilainen <ville.voutilainen@gmail.com>2017-04-03 19:30:58 +0300
committerVille Voutilainen <ville@gcc.gnu.org>2017-04-03 19:30:58 +0300
commitc1e2889a320a2e45eb60b6bb7c1d3d8fc0068582 (patch)
tree974dd12e35bad8b7b5027c7ceb58c8960623a9fa
parent44bc146fcfa43559b27290329dd42158fa1222ad (diff)
downloadgcc-c1e2889a320a2e45eb60b6bb7c1d3d8fc0068582.zip
gcc-c1e2889a320a2e45eb60b6bb7c1d3d8fc0068582.tar.gz
gcc-c1e2889a320a2e45eb60b6bb7c1d3d8fc0068582.tar.bz2
re PR libstdc++/79141 (std::pair<int,int> p = {}; fails to compile due to ambiguous overload)
PR libstdc++/79141 * include/bits/stl_pair.h (__nonesuch_no_braces): New. (operator=(typename conditional< __and_<is_copy_assignable<_T1>, is_copy_assignable<_T2>>::value, const pair&, const __nonesuch&>::type)): Change __nonesuch to __nonesuch_no_braces. (operator=(typename conditional< __not_<__and_<is_copy_assignable<_T1>, is_copy_assignable<_T2>>>::value, const pair&, const __nonesuch&>::type)): Likewise. (operator=(typename conditional< __and_<is_move_assignable<_T1>, is_move_assignable<_T2>>::value, pair&&, __nonesuch&&>::type)): Likewise. * testsuite/20_util/pair/79141.cc: New. From-SVN: r246653
-rw-r--r--libstdc++-v3/ChangeLog19
-rw-r--r--libstdc++-v3/include/bits/stl_pair.h13
-rw-r--r--libstdc++-v3/testsuite/20_util/pair/79141.cc25
3 files changed, 54 insertions, 3 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 62c8288..4073a82 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,24 @@
2017-04-03 Ville Voutilainen <ville.voutilainen@gmail.com>
+ PR libstdc++/79141
+ * include/bits/stl_pair.h (__nonesuch_no_braces): New.
+ (operator=(typename conditional<
+ __and_<is_copy_assignable<_T1>,
+ is_copy_assignable<_T2>>::value,
+ const pair&, const __nonesuch&>::type)): Change __nonesuch
+ to __nonesuch_no_braces.
+ (operator=(typename conditional<
+ __not_<__and_<is_copy_assignable<_T1>,
+ is_copy_assignable<_T2>>>::value,
+ const pair&, const __nonesuch&>::type)): Likewise.
+ (operator=(typename conditional<
+ __and_<is_move_assignable<_T1>,
+ is_move_assignable<_T2>>::value,
+ pair&&, __nonesuch&&>::type)): Likewise.
+ * testsuite/20_util/pair/79141.cc: New.
+
+2017-04-03 Ville Voutilainen <ville.voutilainen@gmail.com>
+
Implement std::is_aggregate.
* include/std/type_traits (is_aggregate, is_aggregate_v): New.
* testsuite/20_util/is_aggregate/requirements/explicit_instantiation.cc:
diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bits/stl_pair.h
index 7c7cee2..b6245b6 100644
--- a/libstdc++-v3/include/bits/stl_pair.h
+++ b/libstdc++-v3/include/bits/stl_pair.h
@@ -179,6 +179,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
};
+ // PR libstdc++/79141, a utility type for preventing
+ // initialization of an argument of a disabled assignment
+ // operator from a pair of empty braces.
+ struct __nonesuch_no_braces : std::__nonesuch {
+ explicit __nonesuch_no_braces(const __nonesuch&) = delete;
+ };
+
#endif
/**
@@ -360,7 +367,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator=(typename conditional<
__and_<is_copy_assignable<_T1>,
is_copy_assignable<_T2>>::value,
- const pair&, const __nonesuch&>::type __p)
+ const pair&, const __nonesuch_no_braces&>::type __p)
{
first = __p.first;
second = __p.second;
@@ -371,13 +378,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator=(typename conditional<
__not_<__and_<is_copy_assignable<_T1>,
is_copy_assignable<_T2>>>::value,
- const pair&, const __nonesuch&>::type __p) = delete;
+ const pair&, const __nonesuch_no_braces&>::type __p) = delete;
pair&
operator=(typename conditional<
__and_<is_move_assignable<_T1>,
is_move_assignable<_T2>>::value,
- pair&&, __nonesuch&&>::type __p)
+ pair&&, __nonesuch_no_braces&&>::type __p)
noexcept(__and_<is_nothrow_move_assignable<_T1>,
is_nothrow_move_assignable<_T2>>::value)
{
diff --git a/libstdc++-v3/testsuite/20_util/pair/79141.cc b/libstdc++-v3/testsuite/20_util/pair/79141.cc
new file mode 100644
index 0000000..d4b5c94
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/pair/79141.cc
@@ -0,0 +1,25 @@
+// { dg-do compile { target c++11 } }
+
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <utility>
+
+int main() {
+ std::pair<int,int> p;
+ p = {};
+}