Bug 88721 - Compile error: 'bool std::isinf(float)' is not 'constexpr' with GCC 4.6 in C++11 mode
Summary: Compile error: 'bool std::isinf(float)' is not 'constexpr' with GCC 4.6 in C+...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Linux
: P1 Normal
Assignee: Balazs Kelemen
URL:
Keywords:
: 89463 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-06-09 18:23 PDT by Floris Bos
Modified: 2012-06-21 06:26 PDT (History)
5 users (show)

See Also:


Attachments
Patch (1.73 KB, patch)
2012-06-20 03:28 PDT, Balazs Kelemen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Floris Bos 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.
Comment 1 Allan Sandfeld Jensen 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.
Comment 2 Allan Sandfeld Jensen 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
Comment 3 Alexey Proskuryakov 2012-06-19 10:45:03 PDT
*** Bug 89463 has been marked as a duplicate of this bug. ***
Comment 4 Balazs Kelemen 2012-06-20 03:28:00 PDT
Created attachment 148531 [details]
Patch
Comment 5 WebKit Review Bot 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.
Comment 6 Allan Sandfeld Jensen 2012-06-20 03:41:59 PDT
Comment on attachment 148531 [details]
Patch

LGTM
Comment 7 Csaba Osztrogonác 2012-06-21 06:06:14 PDT
Comment on attachment 148531 [details]
Patch

LGTM, r=me.
Comment 8 Balazs Kelemen 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>
Comment 9 Balazs Kelemen 2012-06-21 06:26:59 PDT
All reviewed patches have been landed.  Closing bug.