Bug 88721

Summary: Compile error: 'bool std::isinf(float)' is not 'constexpr' with GCC 4.6 in C++11 mode
Product: WebKit Reporter: Floris Bos <bos>
Component: Web Template FrameworkAssignee: Balazs Kelemen <kbalazs>
Status: RESOLVED FIXED    
Severity: Normal CC: allan.jensen, ap, kbalazs, ossy, webkit.review.bot
Priority: P1    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Linux   
Attachments:
Description Flags
Patch none

Floris Bos
Reported 2012-06-09 18:23:46 PDT
Compile error: == [...]/WebKit-r119255/Source/WTF/wtf/MathExtras.h: In function 'bool std::wtf_isinf(float)': [...]/WebKit-r119255/Source/WTF/wtf/MathExtras.h:292:63: error: 'bool std::isinf(float)' is not 'constexpr' [...]/WebKit-r119255/Source/WTF/wtf/MathExtras.h: In function 'bool std::wtf_isinf(double)': [...]/WebKit-r119255/Source/WTF/wtf/MathExtras.h:293:64: error: 'bool std::isinf(double)' is not 'constexpr' [...]/WebKit-r119255/Source/WTF/wtf/MathExtras.h: In function 'bool std::wtf_isnan(float)': [...]/WebKit-r119255/Source/WTF/wtf/MathExtras.h:294:63: error: 'bool std::isnan(float)' is not 'constexpr' [...]/WebKit-r119255/Source/WTF/wtf/MathExtras.h: In function 'bool std::wtf_isnan(double)': [...]/WebKit-r119255/Source/WTF/wtf/MathExtras.h:295:64: error: 'bool std::isnan(double)' is not 'constexpr' == Concerns the following code: == #if COMPILER_QUIRK(GCC11_GLOBAL_ISINF_ISNAN) // A workaround to avoid conflicting declarations of isinf and isnan when compiling with GCC in C++11 mode. namespace std { constexpr bool wtf_isinf(float f) { return std::isinf(f); } constexpr bool wtf_isinf(double d) { return std::isinf(d); } constexpr bool wtf_isnan(float f) { return std::isnan(f); } constexpr bool wtf_isnan(double d) { return std::isnan(d); } }; using std::wtf_isinf; using std::wtf_isnan; #define isinf(x) wtf_isinf(x) #define isnan(x) wtf_isnan(x) #endif == Seems that with the gcc 4.6.3 the function std::isinf() is not marked constexpr, so wtf_isinf() may not be that either. After replacing "constexpr" with "inline" it does compile.
Attachments
Patch (1.73 KB, patch)
2012-06-20 03:28 PDT, Balazs Kelemen
no flags
Allan Sandfeld Jensen
Comment 1 2012-06-12 00:55:09 PDT
(In reply to comment #0) > Seems that with the gcc 4.6.3 the function std::isinf() is not marked constexpr, so wtf_isinf() may not be that either. > After replacing "constexpr" with "inline" it does compile. Ah, interesting. It should be harmless to replace constexpr with inline for gcc 4.7 as well.
Allan Sandfeld Jensen
Comment 2 2012-06-12 00:58:44 PDT
(In reply to comment #1) > (In reply to comment #0) > > Seems that with the gcc 4.6.3 the function std::isinf() is not marked constexpr, so wtf_isinf() may not be that either. > > After replacing "constexpr" with "inline" it does compile. > > Ah, interesting. It should be harmless to replace constexpr with inline for gcc 4.7 as well. I wouldn't call it regression though. C++11 mode was not work
Alexey Proskuryakov
Comment 3 2012-06-19 10:45:03 PDT
*** Bug 89463 has been marked as a duplicate of this bug. ***
Balazs Kelemen
Comment 4 2012-06-20 03:28:00 PDT
WebKit Review Bot
Comment 5 2012-06-20 03:31:20 PDT
Attachment 148531 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WTF/ChangeLog', u'Source/WTF/wtf/Ma..." exit_code: 1 Source/WTF/wtf/MathExtras.h:285: Code inside a namespace should not be indented. [whitespace/indent] [4] Source/WTF/wtf/MathExtras.h:285: wtf_isinf is incorrectly named. Don't use underscores in your identifier names. [readability/naming] [4] Source/WTF/wtf/MathExtras.h:286: wtf_isinf is incorrectly named. Don't use underscores in your identifier names. [readability/naming] [4] Source/WTF/wtf/MathExtras.h:287: wtf_isnan is incorrectly named. Don't use underscores in your identifier names. [readability/naming] [4] Source/WTF/wtf/MathExtras.h:288: wtf_isnan is incorrectly named. Don't use underscores in your identifier names. [readability/naming] [4] Total errors found: 5 in 2 files If any of these errors are false positives, please file a bug against check-webkit-style.
Allan Sandfeld Jensen
Comment 6 2012-06-20 03:41:59 PDT
Comment on attachment 148531 [details] Patch LGTM
Csaba Osztrogonác
Comment 7 2012-06-21 06:06:14 PDT
Comment on attachment 148531 [details] Patch LGTM, r=me.
Balazs Kelemen
Comment 8 2012-06-21 06:26:53 PDT
Comment on attachment 148531 [details] Patch Clearing flags on attachment: 148531 Committed r120922: <http://trac.webkit.org/changeset/120922>
Balazs Kelemen
Comment 9 2012-06-21 06:26:59 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.