aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2010-07-11 09:13:26 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2010-07-11 09:13:26 +0000
commit8e7d962aa5b7b9231bd25efeb4f7c257fcea1a75 (patch)
tree6131447a0283ebcf995f25c030bf4e40d8fd3880
parent23b488ada2fb1b984f25b020292378dc59058c0c (diff)
downloadgcc-8e7d962aa5b7b9231bd25efeb4f7c257fcea1a75.zip
gcc-8e7d962aa5b7b9231bd25efeb4f7c257fcea1a75.tar.gz
gcc-8e7d962aa5b7b9231bd25efeb4f7c257fcea1a75.tar.bz2
type_traits (is_convertible): Use SFINAE.
2010-07-11 Paolo Carlini <paolo.carlini@oracle.com> * include/std/type_traits (is_convertible): Use SFINAE. * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust dg-error line numbers. * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Likewise. * testsuite/20_util/declval/requirements/1_neg.cc: Likewise. From-SVN: r162056
-rw-r--r--libstdc++-v3/ChangeLog9
-rw-r--r--libstdc++-v3/include/std/type_traits20
-rw-r--r--libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc2
-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
5 files changed, 27 insertions, 12 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index d75c55a..d34d242 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,12 @@
+2010-07-11 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/std/type_traits (is_convertible): Use SFINAE.
+ * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust
+ dg-error line numbers.
+ * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
+ Likewise.
+ * testsuite/20_util/declval/requirements/1_neg.cc: Likewise.
+
2010-07-09 Jonathan Wakely <jwakely.gcc@gmail.com>
PR libstdc++/44875
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 42a462e..f4d0b26 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -307,21 +307,27 @@ namespace std
{ };
template<typename _From, typename _To,
- bool = (is_void<_From>::value || is_void<_To>::value
- || is_function<_To>::value || is_array<_To>::value)>
+ bool = (is_void<_From>::value || is_function<_To>::value
+ || is_array<_To>::value)>
struct __is_convertible_helper
- { static const bool __value = (is_void<_From>::value
- && is_void<_To>::value); };
+ { static const bool __value = is_void<_To>::value; };
template<typename _From, typename _To>
class __is_convertible_helper<_From, _To, false>
: public __sfinae_types
{
- static __one __test(_To);
- static __two __test(...);
+ template<typename _To1>
+ static void __test_aux(_To1);
+
+ template<typename _From1, typename _To1>
+ static decltype(__test_aux<_To1>(std::declval<_From1>()), __one())
+ __test(int);
+
+ template<typename, typename>
+ static __two __test(...);
public:
- static const bool __value = sizeof(__test(declval<_From>())) == 1;
+ static const bool __value = sizeof(__test<_From, _To>(0)) == 1;
};
/// is_convertible
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 115c323..f0c6546 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 *-*-* } 676 }
+// { dg-error "static assertion failed" "" { target *-*-* } 682 }
#include <utility>
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 8953dac..8a09c65 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 "instantiated from here" "" { target *-*-* } 40 }
// { dg-error "instantiated from here" "" { target *-*-* } 42 }
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 639 }
-// { dg-error "declaration of" "" { target *-*-* } 603 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 645 }
+// { dg-error "declaration of" "" { target *-*-* } 609 }
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 e06005dc..ba68414 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 "instantiated from here" "" { target *-*-* } 40 }
// { dg-error "instantiated from here" "" { target *-*-* } 42 }
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 562 }
-// { dg-error "declaration of" "" { target *-*-* } 526 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 568 }
+// { dg-error "declaration of" "" { target *-*-* } 532 }