This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Strange C++ function pointer test
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: James Dennett <james dot dennett at gmail dot com>
- Cc: Dominik Vogt <vogt at linux dot vnet dot ibm dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Sat, 2 Jan 2016 11:42:33 +0000
- Subject: Re: Strange C++ function pointer test
- Authentication-results: sourceware.org; auth=none
- References: <20151231094918 dot GA12885 at linux dot vnet dot ibm dot com> <alpine dot DEB dot 2 dot 20 dot 1512311055290 dot 17945 at laptop-mg dot saclay dot inria dot fr> <CAH6eHdTASETHDhGYdC60iOw1PgmtUOhwVT_iJ4Fi4ZCYCzomyg at mail dot gmail dot com> <20151231113458 dot GA19211 at linux dot vnet dot ibm dot com> <alpine dot DEB dot 2 dot 20 dot 1512311240240 dot 23439 at laptop-mg dot saclay dot inria dot fr> <20151231115440 dot GA32205 at linux dot vnet dot ibm dot com> <CAH6eHdSVmicNOqYYX2AweXE=fRYTAX73sAYDGSMq06ZgzAGT1g at mail dot gmail dot com> <CAKNGpgo=2AOiguVf9-JRe9TiGXsi6HbtwBMkBf3hz2_E25QsJg at mail dot gmail dot com>
On 31 December 2015 at 18:49, James Dennett <james.dennett@gmail.com> wrote:
> On Thu, Dec 31, 2015 at 4:42 AM, Jonathan Wakely <jwakely.gcc@gmail.com>
> wrote:
>>
>> On 31 December 2015 at 11:54, Dominik Vogt wrote:
>> > Is there a requirement for a certain minimum Glibc version for
>> > this to work?
>>
>> It doesn't work with any glibc, because it doesn't declare the C++
>> overloads.
>>
>> Libstdc++ has an include/c_compatibility/math.h header that would
>> include <cmath> (which declares the C++ overloads) and then pull them
>> into the global namespace, but that isn't used on GNU/Linux, and would
>> create other problems.
>>
>
> What other problems?
>
> It's something of an assumption of the C++ Standard that it's practical for
> C++ implementations to provide such wrappers to add overloads for C++. If
> that's causing some fundamental problem then we should document it (and
> ideally address it).
Not fundamental problems in the standard, just with the implementation
of that header. It won't work as is and would need changes, but I
don't think doing it that way is the right fix for GNU/Linux anyway.
If we fix it in glibc we don't need that header.
>> This is already in Bugzilla:
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60401
>
>
> I don't see much information on that bug, beyond an assertion that this
> needs coordination with the underlying C library. There's a reference to an
> e-mail thread, but there's little more information in the thread.
Is that a question? :-)
The point is just it's a known bug, not that Bugzilla contains all the
background.
> p.s. a tentatively ready DR indicates that the C++ headers should stop
> splitting the overloads for std::abs/::abs up, so that if you include either
> cmath or cstdlib (or the deprecated/C compatibility headers) you get the
> full overload set. That seems the only way, short of a warning like
> Clang's, to ensure that people write correct code when they use abs().
Yup.