http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54757



Dominique d'Humieres <dominiq at lps dot ens.fr> changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

             Target|hppa2.0w-hp-hpux11.11       |hppa2.0w-hp-hpux11.11

                   |                            |*-*-darwin*

             Status|UNCONFIRMED                 |NEW

   Last reconfirmed|                            |2012-09-30

               Host|hppa2.0w-hp-hpux11.11       |hppa2.0w-hp-hpux11.11

                   |                            |*-*-darwin*

     Ever Confirmed|0                           |1

              Build|hppa2.0w-hp-hpux11.11       |hppa2.0w-hp-hpux11.11

                   |                            |*-*-darwin*



--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2012-09-30 
12:35:12 UTC ---

I also see it on  *-*-darwin*. I have silenced the failures by replacing

std:hypot with hypot.



I have tested the example from

http://en.cppreference.com/w/cpp/numeric/math/hypot , i.e.,



#include <cmath>

#include <utility>

#include <iostream>



std::pair<double, double> cartesian_to_polar(double x, double y)

{

    return {std::hypot(x, y), std::atan2(y,x)};

}



int main()

{

    std::pair<double, double> polar = cartesian_to_polar(1, 1);

    std::cout << "(1,1) cartesian is (" << polar.first

               << "," << polar.second<< ") polar\n";

}



which fails to compile on darwin with



[macbook] f90/bug% g++48 -std=c++11 polar.cpp

polar.cpp: In function 'std::pair<double, double> cartesian_to_polar(double,

double)':

polar.cpp:7:13: error: 'hypot' is not a member of 'std'

     return {std::hypot(x, y), std::atan2(y,x)};

             ^

polar.cpp:7:13: note: suggested alternative:

In file included from /usr/include/math.h:28:0,

                 from /opt/gcc/gcc4.8w/include/c++/4.8.0/cmath:46,

                 from polar.cpp:1:

/usr/include/architecture/i386/math.h:340:15: note:   'hypot'

 extern double hypot ( double, double );

               ^

polar.cpp:7:46: error: could not convert '{<expression error>, atan2(y, x)}'

from '<brace-enclosed initializer list>' to 'std::pair<double, double>'

     return {std::hypot(x, y), std::atan2(y,x)};

                                              ^

while it compiles if I replace " return {std::hypot(x, y), std::atan2(y,x)};"

with " return {hypot(x, y), std::atan2(y,x)}; ". Looking at

include/c++/4.8.0/cmath, I don't understand why std::atan2(y,x) is found, but

not std::hypot(x, y).

Reply via email to