This is the mail archive of the
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: Wed, 6 Jan 2016 21:03:07 +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> <CAH6eHdTBkX3O=C7-1QeY_MGd7MTQyR7aK-yyJ93biFpVx4d+fQ at mail dot gmail dot com>
On 2 January 2016 at 11:42, Jonathan Wakely wrote:
> On 31 December 2015 at 18:49, James Dennett <firstname.lastname@example.org> wrote:
>> On Thu, Dec 31, 2015 at 4:42 AM, Jonathan Wakely <email@example.com>
>>> 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++
>>> 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
Specifically, that header assumes that <cmath> is include/c/cmath, but
for GNU/Linux we use include/c_global/cmath, and IIUC it assumes that
the libc header defines some of the C++ overloads (but not all?),
which isn't true for glibc.
So the combination of include/c/cmath and
include/c_compatibility/math.h wouldn't work. We could change it to
work, but that might break targets using those headers already
(possibly just QNX? I don't know).
If we want to fix it in libstdc++ then I think we need a different
math.h, written from scratch, not starting from