Bug 69350 - Don't define the C99 <math.h> functions in -std=c++98 mode
Summary: Don't define the C99 <math.h> functions in -std=c++98 mode
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 6.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-18 20:59 UTC by Jonathan Wakely
Modified: 2017-10-24 16:21 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2016-01-18 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Wakely 2016-01-18 20:59:59 UTC
std::signbit etc. shouldn't be defined in C++98 mode.

They shouldn't be in namespace std, but for -std=gnu++98 (not -std=c++98) we might want to leave them defined in the global namespace (that won't be possible for GNU/Linux unless/until we stop defining _GNU_SOURCE implicitly).
Comment 1 Jonathan Wakely 2016-02-05 00:36:18 UTC
The simplest solution might be something like:

--- a/libstdc++-v3/include/c_global/cmath
+++ b/libstdc++-v3/include/c_global/cmath
@@ -840,7 +840,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       return __builtin_isunordered(__type(__x), __type(__y));
     }
 
-#else
+#elif !defined(__STRICT_ANSI__)
 
   template<typename _Tp>
     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,