aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely.gcc@gmail.com>2013-06-08 16:12:07 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2013-06-08 17:12:07 +0100
commitdb113eda6da16755879ae51d5b9c8f23e997779c (patch)
tree9541db78d44da77cff915dbc78ac05b1c45dc2c5
parent299316ed37671290b5be88a5e69b6e02b5baf864 (diff)
downloadgcc-db113eda6da16755879ae51d5b9c8f23e997779c.zip
gcc-db113eda6da16755879ae51d5b9c8f23e997779c.tar.gz
gcc-db113eda6da16755879ae51d5b9c8f23e997779c.tar.bz2
type-traits (integral_constant::operator()): Implement N3545.
* include/std/type-traits (integral_constant::operator()): Implement N3545. * testsuite/20_util/integral_constant/call_operator.cc: New. * testsuite/20_util/declval/requirements/1_neg.cc: Adjust dg-error line numbers. * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Likewise. * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Likewise. From-SVN: r199853
-rw-r--r--libstdc++-v3/ChangeLog12
-rw-r--r--libstdc++-v3/include/std/type_traits3
-rw-r--r--libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/integral_constant/call_operator.cc36
-rw-r--r--libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc4
-rw-r--r--libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc4
6 files changed, 56 insertions, 5 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 070ebf2..c198998 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,15 @@
+2013-06-08 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * include/std/type-traits (integral_constant::operator()): Implement
+ N3545.
+ * testsuite/20_util/integral_constant/call_operator.cc: New.
+ * testsuite/20_util/declval/requirements/1_neg.cc: Adjust dg-error
+ line numbers.
+ * testsuite/20_util/make_signed/requirements/typedefs_neg.cc:
+ Likewise.
+ * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
+ Likewise.
+
2013-06-07 Uros Bizjak <ubizjak@gmail.com>
* config/abi/post/alpha-linux-gnu/baseline_symbols.txt: Update.
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index a0a8327..99d0a5b 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -60,6 +60,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef _Tp value_type;
typedef integral_constant<_Tp, __v> type;
constexpr operator value_type() const { return value; }
+#if __cplusplus > 201103L
+ constexpr value_type operator()() const { return value; }
+#endif
};
template<typename _Tp, _Tp __v>
diff --git a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
index ad82190..5b5a8eb 100644
--- a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
@@ -19,7 +19,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// { dg-error "static assertion failed" "" { target *-*-* } 1859 }
+// { dg-error "static assertion failed" "" { target *-*-* } 1862 }
#include <utility>
diff --git a/libstdc++-v3/testsuite/20_util/integral_constant/call_operator.cc b/libstdc++-v3/testsuite/20_util/integral_constant/call_operator.cc
new file mode 100644
index 0000000..c5b0385
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/integral_constant/call_operator.cc
@@ -0,0 +1,36 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++1y" }
+//
+// Copyright (C) 2013 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 <type_traits>
+#include <cassert> //testsuite_hooks.h>
+
+typedef std::integral_constant<int, 1> ic_one;
+typedef std::integral_constant<int, 0> ic_zero;
+typedef std::integral_constant<int, -1> ic_minus_one;
+
+typedef std::integral_constant<bool, true> ic_true;
+typedef std::integral_constant<bool, false> ic_false;
+
+static_assert( ic_one{}() == 1, "1" );
+static_assert( ic_zero{}() == 0, "0" );
+static_assert( ic_minus_one{}() == -1, "-1" );
+
+static_assert( ic_true{}() == true, "true" );
+static_assert( ic_false{}() == false, "false" );
diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
index 077e327..afb7336 100644
--- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
@@ -48,5 +48,5 @@ void test01()
// { dg-error "required from here" "" { target *-*-* } 40 }
// { dg-error "required from here" "" { target *-*-* } 42 }
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1601 }
-// { dg-error "declaration of" "" { target *-*-* } 1565 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1604 }
+// { dg-error "declaration of" "" { target *-*-* } 1568 }
diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
index 2bc1cbb..ba5f582 100644
--- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
@@ -48,5 +48,5 @@ void test01()
// { dg-error "required from here" "" { target *-*-* } 40 }
// { dg-error "required from here" "" { target *-*-* } 42 }
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1519 }
-// { dg-error "declaration of" "" { target *-*-* } 1483 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1522 }
+// { dg-error "declaration of" "" { target *-*-* } 1486 }