This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: pedantic error: incongruent exception specifications in TR1 <functional>
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: John Freeman <jfreeman08 at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>
- Date: Fri, 07 Aug 2009 12:15:18 +0200
- Subject: Re: pedantic error: incongruent exception specifications in TR1 <functional>
- References: <4A7B0DA4.1040803@gmail.com> <FB191273-FFFC-4875-92DB-742C70E6A3EE@oracle.com>
Hi again,
> But I don't think it's ok, because the specialization taking a string
> by value can throw.
I applied the below.
Paolo.
////////////////
2009-08-07 Paolo Carlini <paolo.carlini@oracle.com>
* src/hash.cc (hash<string>::operator()(string),
hash<wstring>::operator()(wstring)): Do not decorate as throwing
nothing.
* include/bits/functional_hash.h (hash<error_code>::
operator()(error_code)): Likewise.
Index: src/hash.cc
===================================================================
--- src/hash.cc (revision 150558)
+++ src/hash.cc (working copy)
@@ -72,7 +72,7 @@
#ifndef _GLIBCXX_LONG_DOUBLE_COMPAT_IMPL
template<>
size_t
- hash<string>::operator()(string __s) const throw ()
+ hash<string>::operator()(string __s) const
{ return _Fnv_hash<>::hash(__s.data(), __s.length()); }
template<>
@@ -83,7 +83,7 @@
#ifdef _GLIBCXX_USE_WCHAR_T
template<>
size_t
- hash<wstring>::operator()(wstring __s) const throw ()
+ hash<wstring>::operator()(wstring __s) const
{
const char* __p = reinterpret_cast<const char*>(__s.data());
return _Fnv_hash<>::hash(__p, __s.length() * sizeof(wchar_t));
Index: include/bits/functional_hash.h
===================================================================
--- include/bits/functional_hash.h (revision 150558)
+++ include/bits/functional_hash.h (working copy)
@@ -1,6 +1,6 @@
// functional_hash.h header -*- C++ -*-
-// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008, 2009 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
@@ -61,7 +61,7 @@
template<>
_GLIBCXX_PURE size_t
- hash<error_code>::operator()(error_code) const throw ();
+ hash<error_code>::operator()(error_code) const;
}
#endif // _FUNCTIONAL_HASH_H