Bug 18838 - [3.4 only] overload resolution depends on previous uses of the symbol
Summary: [3.4 only] overload resolution depends on previous uses of the symbol
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.3.5
: P2 normal
Target Milestone: 4.0.0
Assignee: Alexandre Oliva
URL:
Keywords: patch, rejects-valid
Depends on:
Blocks:
 
Reported: 2004-12-05 00:50 UTC by Richard Henderson
Modified: 2005-02-10 00:13 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 4.0.0
Known to fail: 3.3.5 3.4.3
Last reconfirmed: 2005-02-09 17:21:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Henderson 2004-12-05 00:50:41 UTC
The following is a reduced form of 26_numerics/cmath/fabs_inline.cc
which has failed for a very long time on Alpha, but doesn't fail on
other platforms and so isn't getting fixed.

The problem is that Alpha's headers have an inline version of floor
which uses fabs.  This usage isn't present on other systems.  Which
leads to the following reduced test case

--------------------------------------------------------
extern "C" {
  extern double fabs (double __x) throw () __attribute__ ((__const__));

  __inline double
  fabs (double __x) throw () { return __builtin_fabs (__x); }
}

double fail_me(double __x) { return fabs(__x); }

namespace std
{
  using ::fabs;
}

typedef double (*realfn) (double);

using std::fabs;

int main ()
{
  realfn myfn = fabs;
}
--------------------------------------------------------

which will pass if fail_me is commented out.
Comment 1 Andrew Pinski 2004-12-05 01:33:21 UTC
Confirmed, it is also builtins related too.  Changing it to be a instead of fabs works.
Comment 2 Alexandre Oliva 2005-02-09 13:07:04 UTC
Err...  Just tried this on mainline x86_64-linux-gnu and it didn't fail.  Maybe
it's fixed in mainline?  It seems to be still broken in 3.4.3.
Comment 3 Andrew Pinski 2005-02-09 18:31:49 UTC
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2005-02/msg00370.html>.
Comment 4 Andrew Pinski 2005-02-10 00:13:08 UTC
Closing as fixed per <http://gcc.gnu.org/ml/gcc-patches/2005-02/msg00382.html>.