This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] Fix libstdc++-v3/include/math.h:66:1 2: error: 'constexpr bool std::isnan(double)' conflicts with a previous declaration
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Cc: Gerald Pfeifer <gerald at pfeifer dot com>, John David Anglin <dave dot anglin at bell dot net>
- Date: Mon, 8 Feb 2016 16:01:20 +0000
- Subject: Re: [PATCH] Fix libstdc++-v3/include/math.h:66:1 2: error: 'constexpr bool std::isnan(double)' conflicts with a previous declaration
- Authentication-results: sourceware.org; auth=none
- References: <83B5E03D-B776-49BE-B1C2-23E19D8E9410 at bell dot net> <20160128104655 dot GY15084 at redhat dot com> <alpine dot LSU dot 2 dot 20 dot 1602042306080 dot 3697 at anthias> <56B3D150 dot 8070308 at bell dot net> <20160204224137 dot GH3471 at redhat dot com> <20160205010058 dot GK3471 at redhat dot com> <alpine dot LSU dot 2 dot 20 dot 1602061258550 dot 3806 at anthias> <CAH6eHdS9ZTL-Dmd7060YFQrSpQwwLiWQqsr5maUVP10NT9P_4Q at mail dot gmail dot com>
On 06/02/16 15:31 +0000, Jonathan Wakely wrote:
On 6 February 2016 at 12:51, Gerald Pfeifer <gerald@pfeifer.com> wrote:
On Fri, 5 Feb 2016, Jonathan Wakely wrote:
Can anyone else test this on an older FreeBSD or other target that
isn't gnu/aix/hpux?
Thank you, Jonathan!
I did not have such an older environment available, but now
could install the infrastructure and get all prerequisites in place for
FreeBSD 9.3/AMD64 testing.
That allowed to both reproduce the original failure and confirm
that it does not occur any more with your proposed patch.
OK, thanks. I'll commit it on Monday (with a slight tweak).
This enables the isinf/isnan checks everywhere and also adds #define
_GLIBCXX_INCLUDE_NEXT_C_HEADERS to the configure test, to ensure that
it finds the libc math.h and not an already installed libstdc++
wrapper (which would confuse the test). I also accidentally committed
a change to add 'constexpr' to the configure test, which I reverted.
Tested powerp64-linux, committed to trunk.
commit b0a7399294012b65df3d155da0182e017d6e4214
Author: redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Mon Feb 8 15:22:32 2016 +0000
Enable isinf/isnan checks for all targets
PR libstdc++/48891
* acinclude.m4 (GLIBCXX_CHECK_MATH11_PROTO): Enable isinf and isnan
checks for all targets except *-*-solaris2.* and ensure we find the
libc math.h header not our own.
* configure: Regenerate.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233214 138bc75d-0d04-0410-961f-82ee72b054a4
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 057b58e..e667ccc 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -2215,7 +2215,7 @@ AC_DEFUN([GLIBCXX_CHECK_MATH11_PROTO], [
fi
AC_MSG_RESULT([$glibcxx_cv_math11_overload])
;;
- *-*-*gnu* | *-*-aix* | *-*-hpux*)
+ *)
# If <math.h> defines the obsolete isinf(double) and isnan(double)
# functions (instead of or as well as the C99 generic macros) then we
# can't define std::isinf(double) and std::isnan(double) in <cmath>
@@ -2223,12 +2223,13 @@ AC_DEFUN([GLIBCXX_CHECK_MATH11_PROTO], [
AC_MSG_CHECKING([for obsolete isinf function in <math.h>])
AC_CACHE_VAL(glibcxx_cv_obsolete_isinf, [
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
- [#include <math.h>
+ [#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
+ #include <math.h>
#undef isinf
namespace std {
using ::isinf;
- bool isinf(float);
- bool isinf(long double);
+ constexpr bool isinf(float);
+ constexpr bool isinf(long double);
}
using std::isinf;
bool b = isinf(0.0);
commit 6c1b4080c3cd651e3559bbbf155d1f09236c68ee
Author: redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Mon Feb 8 15:37:59 2016 +0000
Remove accidentally added 'constexpr' in previous commit
* acinclude.m4 (GLIBCXX_CHECK_MATH11_PROTO): Remove accidentally
added 'constexpr' in previous commit.
* configure: Regenerate.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233219 138bc75d-0d04-0410-961f-82ee72b054a4
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index e667ccc..95df24a 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -2228,8 +2228,8 @@ AC_DEFUN([GLIBCXX_CHECK_MATH11_PROTO], [
#undef isinf
namespace std {
using ::isinf;
- constexpr bool isinf(float);
- constexpr bool isinf(long double);
+ bool isinf(float);
+ bool isinf(long double);
}
using std::isinf;
bool b = isinf(0.0);