[PATCH] Define 3-argument overloads of std::hypot for C++17 (P0030R1)
Jonathan Wakely
jwakely@redhat.com
Thu Sep 29 10:58:00 GMT 2016
On 29/09/16 11:47 +0100, Jonathan Wakely wrote:
>On 29/09/16 12:39 +0200, Rainer Orth wrote:
>>Hi Jonathan,
>>
>>>>That would suggest Solaris uses include/c_std/cmath (where I forgot to
>>>>add the new overloads) rather than include/c_global/cmath ... is that
>>>>right?
>>>
>>>Alternatively it's using c_global/cmath but _GLIBCXX_USE_C99_MATH_TR1
>>>is not defined, as the new overloads are inside that block. I thought
>>>that was defined for Solaris though, which is why we have the
>>>__CORRECT_ISO_CPP11_MATH_H_PROTO there in that file.
>>
>>it is indeed, at least initially. What I see in preprocessed input is
>>this:
>>
>>ro@galeras 208 > grep _GLIBCXX_USE_C99_MATH testsuite/normal4/hypot.ii
>>#define _GLIBCXX_USE_C99_MATH _GLIBCXX11_USE_C99_MATH
>>#define _GLIBCXX_USE_C99_MATH_TR1 1
>>#undef _GLIBCXX_USE_C99_MATH
>>#undef _GLIBCXX_USE_C99_MATH_TR1
>>
>>It turns out the #undef's are from <math.h>:
>>
>>#if __cplusplus >= 201103L
>>#undef _GLIBCXX_USE_C99_MATH
>>#undef _GLIBCXX_USE_C99_MATH_TR1
>>#endif
>>
>>No idea what this nonsense is trying to accomplish! It's already in
>>Solaris 11.3, however.
>
>Wow.
>
>If only there was some way the Solaris team could contact us so we
>could coordinate and stop adding more and more hacks to mess with each
>others headers. But I assume they don't have access to the www or
>email, because the only other explanation is too rude to say on a
>public list.
Presumably they now provide all the declarations for C++11, so we
don't need to declare them. Moving the new hypot overload outside the
_GLIBCXX_USE_C99_MATH_TR1 block should mean it's declared. That will
break when Solaris adds C++17 support, so we'd better add some macro
to guard the new hypot overloads, so they can be disabled again. Let's
call it __CORRECT_ISO_CPP17_MATH_H_PROTO (and maybe add a coment like
"Dear Solaris team, ...").
Does this work?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 3150 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20160929/5fc21cbe/attachment.bin>
More information about the Libstdc++
mailing list