From nobody@FreeBSD.org  Sat Aug 24 12:36:41 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTP id E690254A
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 24 Aug 2013 12:36:41 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id B7CD92C3A
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 24 Aug 2013 12:36:41 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id r7OCafv2074782
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 24 Aug 2013 12:36:41 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id r7OCaf2f074761;
	Sat, 24 Aug 2013 12:36:41 GMT
	(envelope-from nobody)
Message-Id: <201308241236.r7OCaf2f074761@oldred.freebsd.org>
Date: Sat, 24 Aug 2013 12:36:41 GMT
From: Jan Beich <jbeich@tormail.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [regression] libstdc++ vs. std::isfinite() since math.h@r253260
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         181501
>Category:       kern
>Synopsis:       [regression] libstdc++ vs. std::isfinite() since math.h@r253260
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    theraven
>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:  Sat Aug 24 16:22:19 UTC 2013
>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:
Responsible-Changed-From-To: freebsd-bugs->theraven 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sat Aug 24 16:20:47 UTC 2013 
Responsible-Changed-Why:  
Over to committer of that change. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=181501 
>Unformatted:
