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: Jakub Jelinek <jakub at redhat dot com>
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>, Andreas Krebbel <krebbel at linux dot vnet dot ibm dot com>
- Date: Thu, 31 Dec 2015 10:02:21 +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> <20151231095754 dot GA18720 at tucnak dot redhat dot com>
On 31 December 2015 at 09:57, Jakub Jelinek wrote:
> On Thu, Dec 31, 2015 at 10:49:18AM +0100, Dominik Vogt wrote:
>> This snippet ist from the Plumhall 2014 xvs test suite:
>> #if CXX03 || CXX11 || CXX14
>> static float (*p1_)(float) = abs;
>> checkthat(__LINE__, p1_ != 0);
>> (With the testsuite specific macros doing the obvious). abs() is
>> declared as:
>> int abs(int j)
> I bet this depends on what headers are included. Doesn't std::abs
> have various overloads, including float -> float one?
> So, is <cmath> included? Is there using namespace std; before this?
That would make it valid, or "using std::abs;". It's also required to
compile if <math.h> is included.