[Bug c++/49813] [C++0x] sinh vs asinh vs constexpr

rguenther at suse dot de gcc-bugzilla@gcc.gnu.org
Fri Jul 22 11:45:00 GMT 2011


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

--- Comment #17 from rguenther at suse dot de <rguenther at suse dot de> 2011-07-22 11:43:57 UTC ---
On Fri, 22 Jul 2011, paolo.carlini at oracle dot com wrote:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49813
> 
> --- Comment #16 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-07-22 11:40:07 UTC ---
> (In reply to comment #14)
> > There is also a using ::asinhf but still std:: provides an overload.
> 
> So? This is what C++0x says we should have.
> 
> As regards a complete testcase, I gave two, one using <math.h>, one a *real
> world* piece of C++0x code, compiled with -std=c++0x on Linux.
> 
> #include <cmath>
> 
> int main()
> {
>   constexpr double cds  = std::sinh(1.0);  // Ok
>   constexpr double cdas = std::asinh(1.0); // Not Ok.
>   double das = std::asinh(1.0);            // Ok.
> }
> 
> we don't want those inconsistencies.
> 
> By the way, I find your:
> 
> constexpr double cdas = __builtin_asinh(1.0);
> 
> very interesting. Looks like really the front-end is doing something strange
> wrt declarations of C99 functions: if <math.h> provided by glibc is include
> then the declarations are definitely there, in strict c++0x mode too, but the
> front-end is trying to invent something on its own, disregards those
> declarations somehow, but *only* when dealing with constexpr data, not
> otherwise.

Is it valid in C++0x to provide a global function

double asinh (double x)
{
  abort ();
}

?  In that case we can't inject __builtin_asinh as asinh into the
global namespace (as -std=gnu++0x does) and the using ::asinh
is bogus(?)

If the above is invalid then with -std=c++0x the C++ frontend should
set flag_iso_c99 to true.

Richard.



More information about the Gcc-bugs mailing list