[Webkit-unassigned] [Bug 59249] Colliding isinf/isnan between C99 and C++0x with GCC 4.6.0

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu May 5 14:16:06 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=59249





--- Comment #17 from Alexis Menard <alexis.menard at openbossa.org>  2011-05-05 14:16:06 PST ---
(In reply to comment #16)
> (In reply to comment #15)
> > I'm saying that if you do :
> > 
> > using namespace std;
> > using namespace other;
> > 
> > you may have name collisions.
> 
> Yes, exactly. And if you do, then you can’t use using namespace for both.
> 
> But that’s not what’s happening here.

So I investigated a bit with a simple example like this :

#include <stdlib.h>
#include <cmath>
#include <stdio.h>

using namespace std;

int main(int argc, char** argv)
{
    double number = 0;
    if (isnan(number))
    {
        printf("Nan\n");
    }
    return 0;
}

and to compile call g++ main.cpp -std=c++0x -std=gnu++0x -o test.

It reproduces the issue. Now if I turn off the c++0x support it compiles fine.

The real issue is that the c++0x standard removes the prohibition on C++ headers declaring C names in the global namespace. Our problem here (even in the example) is that indirectly math.h is included therefore the error comes.

I'm not really sure how the compiler can solve that. The float overloads seems new in gcc 4.6.0 that's why it only fails with 4.6.0.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list