aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2010-06-10 00:43:50 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2010-06-10 00:43:50 +0000
commite4f32cb0a55eefcd56b1c42bcaf5c8aadc692ba6 (patch)
tree82da2d0a7749716300e33183ea21af0081cd90ea /libstdc++-v3/include
parent3cebddd64350cdfa5c9a6ef4ba68b9a506e10ead (diff)
downloadgcc-e4f32cb0a55eefcd56b1c42bcaf5c8aadc692ba6.zip
gcc-e4f32cb0a55eefcd56b1c42bcaf5c8aadc692ba6.tar.gz
gcc-e4f32cb0a55eefcd56b1c42bcaf5c8aadc692ba6.tar.bz2
type_traits (is_nothrow_constructible): Add.
2010-06-09 Paolo Carlini <paolo.carlini@oracle.com> * include/std/type_traits (is_nothrow_constructible): Add. (declval): Add noexcept specification. * testsuite/util/testsuite_tr1.h (struct NothrowExplicitClass, ThrowExplicitClass, NoexceptExplicitClass, ExceptExplicitClass): Add. * testsuite/20_util/is_nothrow_constructible/value.cc: New. * testsuite/20_util/is_nothrow_constructible/requirements/ typedefs.cc: Likewise. * testsuite/20_util/is_nothrow_constructible/requirements/ explicit_instantiation.cc: Likewise. * 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: r160523
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r--libstdc++-v3/include/std/type_traits26
1 files changed, 24 insertions, 2 deletions
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index ba9d62c..42a462e 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -193,7 +193,7 @@ namespace std
{ };
template<typename _Tp>
- typename add_rvalue_reference<_Tp>::type declval();
+ typename add_rvalue_reference<_Tp>::type declval() noexcept;
template<typename _Tp, typename... _Args>
class __is_constructible_helper
@@ -234,6 +234,28 @@ namespace std
_Args...>::__value>
{ };
+ template<bool, typename _Tp, typename... _Args>
+ struct __is_nt_constructible_helper
+ { static const bool __value = false; };
+
+ template<typename _Tp, typename... _Args>
+ struct __is_nt_constructible_helper<true, _Tp, _Args...>
+ { static const bool __value = noexcept(_Tp(declval<_Args>()...)); };
+
+ template<typename _Tp, typename _Arg>
+ struct __is_nt_constructible_helper<true, _Tp, _Arg>
+ {
+ static const bool __value = noexcept(static_cast<_Tp>(declval<_Arg>()));
+ };
+
+ /// is_nothrow_constructible
+ template<typename _Tp, typename... _Args>
+ struct is_nothrow_constructible
+ : public integral_constant<bool,
+ __is_nt_constructible_helper<is_constructible<_Tp, _Args...>::value,
+ _Tp, _Args...>::__value>
+ { };
+
/// has_trivial_default_constructor
template<typename _Tp>
struct has_trivial_default_constructor
@@ -649,7 +671,7 @@ namespace std
template<typename _Tp>
inline typename add_rvalue_reference<_Tp>::type
- declval()
+ declval() noexcept
{
static_assert(__declval_protector<_Tp>::__stop,
"declval() must not be used!");