kern/181501: [regression] libstdc++ vs. std::isfinite() since math.h at r253260
Jan Beich
jbeich at tormail.org
Sat Aug 24 12:40:01 UTC 2013
>Number: 181501
>Category: kern
>Synopsis: [regression] libstdc++ vs. std::isfinite() since math.h at r253260
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sat Aug 24 12:40:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator: Jan Beich
>Release: FreeBSD 10.0-CURRENT amd64
>Organization:
>Environment:
>Description:
Recent math.h cleanup made c++ inconsistent in how it treats an integer
argument for float functions between different standard libraries.
cf. http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-January/027280.html
>How-To-Repeat:
$ cat a.cc
#include <cmath>
int main()
{
std::isfinite(5);
return 0;
}
$ c++ -stdlib=libc++ a.cc
$ c++ -stdlib=libstdc++ a.cc
In file included from a.cc:1:
/usr/include/c++/4.2/cmath:472:51: error: controlling expression type 'int' not compatible with any generic association type
__capture_isfinite(_Tp __f) { return isfinite(__f); }
^~~
/usr/include/math.h:115:38: note: expanded from macro 'isfinite'
#define isfinite(x) __fp_type_select(x, __isfinitef, __isfinite, __isfinitel)
^
/usr/include/math.h:86:49: note: expanded from macro '__fp_type_select'
#define __fp_type_select(x, f, d, ld) _Generic((x), \
^
/usr/include/c++/4.2/cmath:543:45: note: in instantiation of function template specialization '__gnu_cxx::__capture_isfinite<int>' requested here
isfinite(_Tp __f) { return ::__gnu_cxx::__capture_isfinite(__f); }
^
a.cc:5:8: note: in instantiation of function template specialization 'std::isfinite<int>' requested here
std::isfinite(5);
^
1 error generated.
>Fix:
either !defined(__cplusplus) or !defined(__GLIBCXX__)
--- math.h_cxx.diff begins here ---
Index: lib/msun/src/math.h
===================================================================
--- lib/msun/src/math.h (revision 254772)
+++ lib/msun/src/math.h (working copy)
@@ -82,7 +82,7 @@ extern const union __nan_un {
#define FP_ZERO 0x10
#if (__STDC_VERSION__ >= 201112L && defined(__clang__)) || \
- __has_extension(c_generic_selections)
+ __has_extension(c_generic_selections) && !defined(__cplusplus)
#define __fp_type_select(x, f, d, ld) _Generic((x), \
float: f(x), \
double: d(x), \
--- math.h_cxx.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list