PR c++/33979 (partial)

2008-05-20  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/33979 (partial)
	* include/tr1_impl/functional_hash.h (hash<char16_t>,
	hash<char32_t>): Add specializations.
	* include/tr1_impl/type_traits (is_integral<char16_t>,
	is_integral<char32_t>): Likewise.
	* include/std/limits (numeric_limits<char16_t>,
	numeric_limits<char32_t>): Likewise.
	* src/limits_c++0x.cc: Add.
	* src/Makefile.am: Update.
	* testsuite/20_util/hash/requirements/explicit_instantiation.cc:
	Update.
	* testsuite/20_util/is_integral/value.cc: New.
	* testsuite/20_util/is_integral/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_integral/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/18_support/numeric_limits/char16_32_t.cc: Likewise.	
	* config/abi/pre/gnu.ver: Export new numeric_limits symbols at
	GLIBCXX_3.4.11.
	* configure: Regenerate.
	* src/Makefile.in: Likewise.
	* config.h.in: Likewise.

From-SVN: r135668
This commit is contained in:
Paolo Carlini 2008-05-20 18:11:34 +00:00 committed by Paolo Carlini
parent f30fad6135
commit 5fb0445da6
15 changed files with 493 additions and 106 deletions

View File

@ -1,3 +1,27 @@
2008-05-20 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/33979 (partial)
* include/tr1_impl/functional_hash.h (hash<char16_t>,
hash<char32_t>): Add specializations.
* include/tr1_impl/type_traits (is_integral<char16_t>,
is_integral<char32_t>): Likewise.
* include/std/limits (numeric_limits<char16_t>,
numeric_limits<char32_t>): Likewise.
* src/limits_c++0x.cc: Add.
* src/Makefile.am: Update.
* testsuite/20_util/hash/requirements/explicit_instantiation.cc:
Update.
* testsuite/20_util/is_integral/value.cc: New.
* testsuite/20_util/is_integral/requirements/typedefs.cc: Likewise.
* testsuite/20_util/is_integral/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/18_support/numeric_limits/char16_32_t.cc: Likewise.
* config/abi/pre/gnu.ver: Export new numeric_limits symbols at
GLIBCXX_3.4.11.
* configure: Regenerate.
* src/Makefile.in: Likewise.
* config.h.in: Likewise.
2008-05-16 Benjamin Kosnik <bkoz@redhat.com>
* include/std/system_error: Align to current draft specifications.

View File

@ -379,9 +379,6 @@
/* Define to 1 if you have the <sys/machine.h> header file. */
#undef HAVE_SYS_MACHINE_H
/* Define if sys_nerr exists. */
#undef HAVE_SYS_NERR
/* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H

View File

@ -383,7 +383,8 @@ GLIBCXX_3.4 {
_ZNKSt9money_putI[cw]St19ostreambuf_iteratorI[cw]St11char_traitsI[cw]EEE*;
# std::numeric_limits
_ZNSt14numeric_limitsI[^g]*;
# _ZNSt14numeric_limitsI[^g]*;
_ZNSt14numeric_limitsI[a-z]E*;
# std::_Rb_tree
_ZSt18_Rb_tree_decrementPKSt18_Rb_tree_node_base;
@ -891,6 +892,9 @@ GLIBCXX_3.4.11 {
_ZNSt11system_time16ticks_per_secondE;
_ZNSt11system_time12is_subsecondE;
# char16_t and char32_t
_ZNSt14numeric_limitsIu8char*;
} GLIBCXX_3.4.10;
# Symbols in the support library (libsupc++) have their own tag.

113
libstdc++-v3/configure vendored
View File

@ -17842,8 +17842,8 @@ cat >>confdefs.h <<\_ACEOF
_ACEOF
fi
echo "$as_me:$LINENO: checking for sys_nerr" >&5
echo $ECHO_N "checking for sys_nerr... $ECHO_C" >&6
echo "$as_me:$LINENO: checking for EBADMSG" >&5
echo $ECHO_N "checking for EBADMSG... $ECHO_C" >&6
if test "${glibcxx_cv_system_error9+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@ -17858,7 +17858,7 @@ cat >>conftest.$ac_ext <<_ACEOF
int
main ()
{
int i = sys_nerr;
int i = EBADMSG;
;
return 0;
}
@ -17901,12 +17901,12 @@ echo "${ECHO_T}$glibcxx_cv_system_error9" >&6
if test x"$glibcxx_cv_system_error9" = x"yes"; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_SYS_NERR 1
#define HAVE_EBADMSG 1
_ACEOF
fi
echo "$as_me:$LINENO: checking for EBADMSG" >&5
echo $ECHO_N "checking for EBADMSG... $ECHO_C" >&6
echo "$as_me:$LINENO: checking for ECANCELED" >&5
echo $ECHO_N "checking for ECANCELED... $ECHO_C" >&6
if test "${glibcxx_cv_system_error10+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@ -17921,7 +17921,7 @@ cat >>conftest.$ac_ext <<_ACEOF
int
main ()
{
int i = EBADMSG;
int i = ECANCELED;
;
return 0;
}
@ -17964,12 +17964,12 @@ echo "${ECHO_T}$glibcxx_cv_system_error10" >&6
if test x"$glibcxx_cv_system_error10" = x"yes"; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_EBADMSG 1
#define HAVE_ECANCELED 1
_ACEOF
fi
echo "$as_me:$LINENO: checking for ECANCELED" >&5
echo $ECHO_N "checking for ECANCELED... $ECHO_C" >&6
echo "$as_me:$LINENO: checking for EOVERFLOW" >&5
echo $ECHO_N "checking for EOVERFLOW... $ECHO_C" >&6
if test "${glibcxx_cv_system_error11+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@ -17984,7 +17984,7 @@ cat >>conftest.$ac_ext <<_ACEOF
int
main ()
{
int i = ECANCELED;
int i = EOVERFLOW;
;
return 0;
}
@ -18027,12 +18027,12 @@ echo "${ECHO_T}$glibcxx_cv_system_error11" >&6
if test x"$glibcxx_cv_system_error11" = x"yes"; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_ECANCELED 1
#define HAVE_EOVERFLOW 1
_ACEOF
fi
echo "$as_me:$LINENO: checking for EOVERFLOW" >&5
echo $ECHO_N "checking for EOVERFLOW... $ECHO_C" >&6
echo "$as_me:$LINENO: checking for ENOTSUP" >&5
echo $ECHO_N "checking for ENOTSUP... $ECHO_C" >&6
if test "${glibcxx_cv_system_error12+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@ -18047,7 +18047,7 @@ cat >>conftest.$ac_ext <<_ACEOF
int
main ()
{
int i = EOVERFLOW;
int i = ENOTSUP;
;
return 0;
}
@ -18090,12 +18090,12 @@ echo "${ECHO_T}$glibcxx_cv_system_error12" >&6
if test x"$glibcxx_cv_system_error12" = x"yes"; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_EOVERFLOW 1
#define HAVE_ENOTSUP 1
_ACEOF
fi
echo "$as_me:$LINENO: checking for ENOTSUP" >&5
echo $ECHO_N "checking for ENOTSUP... $ECHO_C" >&6
echo "$as_me:$LINENO: checking for EIDRM" >&5
echo $ECHO_N "checking for EIDRM... $ECHO_C" >&6
if test "${glibcxx_cv_system_error13+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@ -18110,7 +18110,7 @@ cat >>conftest.$ac_ext <<_ACEOF
int
main ()
{
int i = ENOTSUP;
int i = EIDRM;
;
return 0;
}
@ -18152,69 +18152,6 @@ echo "$as_me:$LINENO: result: $glibcxx_cv_system_error13" >&5
echo "${ECHO_T}$glibcxx_cv_system_error13" >&6
if test x"$glibcxx_cv_system_error13" = x"yes"; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_ENOTSUP 1
_ACEOF
fi
echo "$as_me:$LINENO: checking for EIDRM" >&5
echo $ECHO_N "checking for EIDRM... $ECHO_C" >&6
if test "${glibcxx_cv_system_error14+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <errno.h>
int
main ()
{
int i = EIDRM;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
glibcxx_cv_system_error14=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
glibcxx_cv_system_error14=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $glibcxx_cv_system_error14" >&5
echo "${ECHO_T}$glibcxx_cv_system_error14" >&6
if test x"$glibcxx_cv_system_error14" = x"yes"; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_EIDRM 1
_ACEOF
@ -18222,7 +18159,7 @@ _ACEOF
fi
echo "$as_me:$LINENO: checking for ETXTBSY" >&5
echo $ECHO_N "checking for ETXTBSY... $ECHO_C" >&6
if test "${glibcxx_cv_system_error15+set}" = set; then
if test "${glibcxx_cv_system_error14+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@ -18263,20 +18200,20 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
glibcxx_cv_system_error15=yes
glibcxx_cv_system_error14=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
glibcxx_cv_system_error15=no
glibcxx_cv_system_error14=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $glibcxx_cv_system_error15" >&5
echo "${ECHO_T}$glibcxx_cv_system_error15" >&6
if test x"$glibcxx_cv_system_error15" = x"yes"; then
echo "$as_me:$LINENO: result: $glibcxx_cv_system_error14" >&5
echo "${ECHO_T}$glibcxx_cv_system_error14" >&6
if test x"$glibcxx_cv_system_error14" = x"yes"; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_ETXTBSY 1

View File

@ -566,6 +566,110 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
static const float_round_style round_style = round_toward_zero;
};
#ifdef __GXX_EXPERIMENTAL_CXX0X__
/// numeric_limits<char16_t> specialization.
template<>
struct numeric_limits<char16_t>
{
static const bool is_specialized = true;
static char16_t min() throw()
{ return __glibcxx_min (char16_t); }
static char16_t max() throw()
{ return __glibcxx_max (char16_t); }
static const int digits = __glibcxx_digits (char16_t);
static const int digits10 = __glibcxx_digits10 (char16_t);
static const bool is_signed = __glibcxx_signed (char16_t);
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static char16_t epsilon() throw()
{ return 0; }
static char16_t round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static char16_t infinity() throw()
{ return char16_t(); }
static char16_t quiet_NaN() throw()
{ return char16_t(); }
static char16_t signaling_NaN() throw()
{ return char16_t(); }
static char16_t denorm_min() throw()
{ return char16_t(); }
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = true;
static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
/// numeric_limits<char32_t> specialization.
template<>
struct numeric_limits<char32_t>
{
static const bool is_specialized = true;
static char32_t min() throw()
{ return __glibcxx_min (char32_t); }
static char32_t max() throw()
{ return __glibcxx_max (char32_t); }
static const int digits = __glibcxx_digits (char32_t);
static const int digits10 = __glibcxx_digits10 (char32_t);
static const bool is_signed = __glibcxx_signed (char32_t);
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static char32_t epsilon() throw()
{ return 0; }
static char32_t round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static char32_t infinity() throw()
{ return char32_t(); }
static char32_t quiet_NaN() throw()
{ return char32_t(); }
static char32_t signaling_NaN() throw()
{ return char32_t(); }
static char32_t denorm_min() throw()
{ return char32_t(); }
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = true;
static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
#endif
/// numeric_limits<short> specialization.
template<>
struct numeric_limits<short>

View File

@ -67,6 +67,10 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
_TR1_hashtable_define_trivial_hash(signed char);
_TR1_hashtable_define_trivial_hash(unsigned char);
_TR1_hashtable_define_trivial_hash(wchar_t);
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
_TR1_hashtable_define_trivial_hash(char16_t);
_TR1_hashtable_define_trivial_hash(char32_t);
#endif
_TR1_hashtable_define_trivial_hash(short);
_TR1_hashtable_define_trivial_hash(int);
_TR1_hashtable_define_trivial_hash(long);

View File

@ -101,6 +101,10 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
_DEFINE_SPEC(0, is_integral, unsigned char, true)
#ifdef _GLIBCXX_USE_WCHAR_T
_DEFINE_SPEC(0, is_integral, wchar_t, true)
#endif
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
_DEFINE_SPEC(0, is_integral, char16_t, true)
_DEFINE_SPEC(0, is_integral, char32_t, true)
#endif
_DEFINE_SPEC(0, is_integral, short, true)
_DEFINE_SPEC(0, is_integral, unsigned short, true)

View File

@ -1,6 +1,7 @@
## Makefile for the src subdirectory of the GNU C++ Standard library.
##
## Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005
## Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
## 2006, 2007, 2008
## Free Software Foundation, Inc.
##
## This file is part of the libstdc++ version 3 distribution.
@ -155,6 +156,7 @@ sources = \
ios_init.cc \
ios_locale.cc \
limits.cc \
limits_c++0x.cc \
list.cc \
debug_list.cc \
locale.cc \
@ -261,6 +263,11 @@ hashtable_c++0x.lo: hashtable_c++0x.cc
hashtable_c++0x.o: hashtable_c++0x.cc
$(CXXCOMPILE) -std=gnu++0x -c $<
limits_c++0x.lo: limits_c++0x.cc
$(LTCXXCOMPILE) -std=gnu++0x -c $<
limits_c++0x.o: limits_c++0x.cc
$(CXXCOMPILE) -std=gnu++0x -c $<
date_time.lo: date_time.cc
$(LTCXXCOMPILE) -std=gnu++0x -c $<
date_time.o: date_time.cc

View File

@ -77,17 +77,17 @@ am__libstdc___la_SOURCES_DIST = atomic.cc bitmap_allocator.cc \
complex_io.cc ctype.cc date_time.cc debug.cc functexcept.cc \
hash.cc hash_c++0x.cc globals_io.cc hashtable.cc \
hashtable_c++0x.cc ios.cc ios_failure.cc ios_init.cc \
ios_locale.cc limits.cc list.cc debug_list.cc locale.cc \
locale_init.cc locale_facets.cc localename.cc stdexcept.cc \
strstream.cc system_error.cc tree.cc allocator-inst.cc \
concept-inst.cc fstream-inst.cc ext-inst.cc ios-inst.cc \
iostream-inst.cc istream-inst.cc istream.cc locale-inst.cc \
misc-inst.cc ostream-inst.cc sstream-inst.cc streambuf-inst.cc \
streambuf.cc string-inst.cc valarray-inst.cc wlocale-inst.cc \
wstring-inst.cc mutex.cc condition_variable.cc atomicity.cc \
codecvt_members.cc collate_members.cc ctype_members.cc \
messages_members.cc monetary_members.cc numeric_members.cc \
time_members.cc basic_file.cc c++locale.cc \
ios_locale.cc limits.cc limits_c++0x.cc list.cc debug_list.cc \
locale.cc locale_init.cc locale_facets.cc localename.cc \
stdexcept.cc strstream.cc system_error.cc tree.cc \
allocator-inst.cc concept-inst.cc fstream-inst.cc ext-inst.cc \
ios-inst.cc iostream-inst.cc istream-inst.cc istream.cc \
locale-inst.cc misc-inst.cc ostream-inst.cc sstream-inst.cc \
streambuf-inst.cc streambuf.cc string-inst.cc valarray-inst.cc \
wlocale-inst.cc wstring-inst.cc mutex.cc condition_variable.cc \
atomicity.cc codecvt_members.cc collate_members.cc \
ctype_members.cc messages_members.cc monetary_members.cc \
numeric_members.cc time_members.cc basic_file.cc c++locale.cc \
compatibility-ldbl.cc parallel_list.cc parallel_settings.cc
am__objects_1 = atomicity.lo codecvt_members.lo collate_members.lo \
ctype_members.lo messages_members.lo monetary_members.lo \
@ -102,7 +102,7 @@ am__objects_5 = atomic.lo bitmap_allocator.lo pool_allocator.lo \
ctype.lo date_time.lo debug.lo functexcept.lo hash.lo \
hash_c++0x.lo globals_io.lo hashtable.lo hashtable_c++0x.lo \
ios.lo ios_failure.lo ios_init.lo ios_locale.lo limits.lo \
list.lo debug_list.lo locale.lo locale_init.lo \
limits_c++0x.lo list.lo debug_list.lo locale.lo locale_init.lo \
locale_facets.lo localename.lo stdexcept.lo strstream.lo \
system_error.lo tree.lo allocator-inst.lo concept-inst.lo \
fstream-inst.lo ext-inst.lo ios-inst.lo iostream-inst.lo \
@ -392,6 +392,7 @@ sources = \
ios_init.cc \
ios_locale.cc \
limits.cc \
limits_c++0x.cc \
list.cc \
debug_list.cc \
locale.cc \
@ -856,6 +857,11 @@ hashtable_c++0x.lo: hashtable_c++0x.cc
hashtable_c++0x.o: hashtable_c++0x.cc
$(CXXCOMPILE) -std=gnu++0x -c $<
limits_c++0x.lo: limits_c++0x.cc
$(LTCXXCOMPILE) -std=gnu++0x -c $<
limits_c++0x.o: limits_c++0x.cc
$(CXXCOMPILE) -std=gnu++0x -c $<
date_time.lo: date_time.cc
$(LTCXXCOMPILE) -std=gnu++0x -c $<
date_time.o: date_time.cc

View File

@ -0,0 +1,81 @@
// std::limits definitions -*- C++ -*-
// Copyright (C) 2008 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 2, 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 COPYING. If not, write to the Free
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#include <limits>
namespace std
{
// char16_t
const bool numeric_limits<char16_t>::is_specialized;
const int numeric_limits<char16_t>::digits;
const int numeric_limits<char16_t>::digits10;
const bool numeric_limits<char16_t>::is_signed;
const bool numeric_limits<char16_t>::is_integer;
const bool numeric_limits<char16_t>::is_exact;
const int numeric_limits<char16_t>::radix;
const int numeric_limits<char16_t>::min_exponent;
const int numeric_limits<char16_t>::min_exponent10;
const int numeric_limits<char16_t>::max_exponent;
const int numeric_limits<char16_t>::max_exponent10;
const bool numeric_limits<char16_t>::has_infinity;
const bool numeric_limits<char16_t>::has_quiet_NaN;
const bool numeric_limits<char16_t>::has_signaling_NaN;
const float_denorm_style numeric_limits<char16_t>::has_denorm;
const bool numeric_limits<char16_t>::has_denorm_loss;
const bool numeric_limits<char16_t>::is_iec559;
const bool numeric_limits<char16_t>::is_bounded;
const bool numeric_limits<char16_t>::is_modulo;
const bool numeric_limits<char16_t>::traps;
const bool numeric_limits<char16_t>::tinyness_before;
const float_round_style numeric_limits<char16_t>::round_style;
// char32_t
const bool numeric_limits<char32_t>::is_specialized;
const int numeric_limits<char32_t>::digits;
const int numeric_limits<char32_t>::digits10;
const bool numeric_limits<char32_t>::is_signed;
const bool numeric_limits<char32_t>::is_integer;
const bool numeric_limits<char32_t>::is_exact;
const int numeric_limits<char32_t>::radix;
const int numeric_limits<char32_t>::min_exponent;
const int numeric_limits<char32_t>::min_exponent10;
const int numeric_limits<char32_t>::max_exponent;
const int numeric_limits<char32_t>::max_exponent10;
const bool numeric_limits<char32_t>::has_infinity;
const bool numeric_limits<char32_t>::has_quiet_NaN;
const bool numeric_limits<char32_t>::has_signaling_NaN;
const float_denorm_style numeric_limits<char32_t>::has_denorm;
const bool numeric_limits<char32_t>::has_denorm_loss;
const bool numeric_limits<char32_t>::is_iec559;
const bool numeric_limits<char32_t>::is_bounded;
const bool numeric_limits<char32_t>::is_modulo;
const bool numeric_limits<char32_t>::traps;
const bool numeric_limits<char32_t>::tinyness_before;
const float_round_style numeric_limits<char32_t>::round_style;
}

View File

@ -0,0 +1,77 @@
// { dg-options "-std=gnu++0x" }
// 2008-05-20 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2008 Free Software Foundation
//
// 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 2, 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 COPYING. If not, write to the Free
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
// 18.2.1.1 template class numeric_limits
#include <limits>
#include <cstdint>
#include <testsuite_hooks.h>
// Test specializations for char16_t and char32_t, in C++0x.
template<typename T, typename R>
void
do_test()
{
bool test __attribute__((unused)) = true;
typedef std::numeric_limits<T> char_type;
typedef std::numeric_limits<R> impl_type;
VERIFY( char_type::is_specialized == impl_type::is_specialized );
VERIFY( char_type::min() == impl_type::min() );
VERIFY( char_type::max() == impl_type::max() );
VERIFY( char_type::digits == impl_type::digits );
VERIFY( char_type::digits10 == impl_type::digits10 );
VERIFY( char_type::is_signed == impl_type::is_signed );
VERIFY( char_type::is_integer == impl_type::is_integer );
VERIFY( char_type::is_exact == impl_type::is_exact );
VERIFY( char_type::radix == impl_type::radix );
VERIFY( char_type::epsilon() == impl_type::epsilon() );
VERIFY( char_type::round_error() == impl_type::round_error() );
VERIFY( char_type::min_exponent == impl_type::min_exponent );
VERIFY( char_type::min_exponent10 == impl_type::min_exponent10 );
VERIFY( char_type::max_exponent == impl_type::max_exponent );
VERIFY( char_type::max_exponent10 == impl_type::max_exponent10 );
VERIFY( char_type::has_infinity == impl_type::has_infinity );
VERIFY( char_type::has_quiet_NaN == impl_type::has_quiet_NaN );
VERIFY( char_type::has_signaling_NaN == impl_type::has_signaling_NaN );
VERIFY( char_type::has_denorm == impl_type::has_denorm );
VERIFY( char_type::has_denorm_loss == impl_type::has_denorm_loss );
VERIFY( char_type::infinity() == impl_type::infinity() );
VERIFY( char_type::quiet_NaN() == impl_type::quiet_NaN() );
VERIFY( char_type::signaling_NaN() == impl_type::signaling_NaN() );
VERIFY( char_type::denorm_min() == impl_type::denorm_min() );
VERIFY( char_type::is_iec559 == impl_type::is_iec559 );
VERIFY( char_type::is_bounded == impl_type::is_bounded );
VERIFY( char_type::is_modulo == impl_type::is_modulo );
VERIFY( char_type::traps == impl_type::traps );
VERIFY( char_type::tinyness_before == impl_type::tinyness_before );
VERIFY( char_type::round_style == impl_type::round_style );
}
int main()
{
#if _GLIBCXX_USE_C99_STDINT_TR1
do_test<char16_t, uint_least16_t>();
do_test<char32_t, uint_least32_t>();
#endif
return 0;
}

View File

@ -1,7 +1,7 @@
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2007 Free Software Foundation, Inc.
// Copyright (C) 2007, 2008 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
@ -28,6 +28,8 @@ template class std::hash<bool>;
template class std::hash<char>;
template class std::hash<signed char>;
template class std::hash<unsigned char>;
template class std::hash<char16_t>;
template class std::hash<char32_t>;
template class std::hash<short>;
template class std::hash<int>;
template class std::hash<long>;

View File

@ -0,0 +1,40 @@
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// 2008-05-20 Paolo Carlini <paolo.carlini@oracle.com>
// Copyright (C) 2008 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 2, 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 COPYING. If not, write to the Free
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct is_integral<test_type>;
}

View File

@ -0,0 +1,37 @@
// { dg-options "-std=gnu++0x" }
// 2008-05-20 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2008 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 2, 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 COPYING. If not, write to the Free
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
//
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
// { dg-do compile }
void test01()
{
// Check for required typedefs
typedef std::is_integral<int> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}

View File

@ -0,0 +1,63 @@
// { dg-options "-std=gnu++0x" }
// 2008-05-20 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2008 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 2, 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 COPYING. If not, write to the Free
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
#include <type_traits>
#include <testsuite_hooks.h>
#include <testsuite_tr1.h>
void test01()
{
bool test __attribute__((unused)) = true;
using std::is_integral;
using namespace __gnu_test;
VERIFY( (test_category<is_integral, void>(false)) );
VERIFY( (test_category<is_integral, char>(true)) );
VERIFY( (test_category<is_integral, signed char>(true)) );
VERIFY( (test_category<is_integral, unsigned char>(true)) );
#ifdef _GLIBCXX_USE_WCHAR_T
VERIFY( (test_category<is_integral, wchar_t>(true)) );
#endif
VERIFY( (test_category<is_integral, char16_t>(true)) );
VERIFY( (test_category<is_integral, char32_t>(true)) );
VERIFY( (test_category<is_integral, short>(true)) );
VERIFY( (test_category<is_integral, unsigned short>(true)) );
VERIFY( (test_category<is_integral, int>(true)) );
VERIFY( (test_category<is_integral, unsigned int>(true)) );
VERIFY( (test_category<is_integral, long>(true)) );
VERIFY( (test_category<is_integral, unsigned long>(true)) );
VERIFY( (test_category<is_integral, long long>(true)) );
VERIFY( (test_category<is_integral, unsigned long long>(true)) );
VERIFY( (test_category<is_integral, float>(false)) );
VERIFY( (test_category<is_integral, double>(false)) );
VERIFY( (test_category<is_integral, long double>(false)) );
// Sanity check.
VERIFY( (test_category<is_integral, ClassType>(false)) );
}
int main()
{
test01();
return 0;
}