Some shadow fixes.

Nathan Myers ncm@cantrip.org
Thu May 18 20:32:00 GMT 2000


On Thu, May 18, 2000 at 07:09:26PM -0700, Steven King wrote:
> On Thu, 18 May 2000, Nathan Myers wrote:
> > 
> > I think I see.  We need to put code in both headers, something like:
> > 
> >   #ifndef _CPP_ALREADY_EXPORTED_ABS
> >   # define _CPP_ALREADY_EXPORTED_ABS 1
> >     using std::abs;
> >   #endif
> 
>   Hmmm, in rereading 7.3.3, this may just be the result of a gcc bug.
> What seems to be happening is, given
> 
> namespace std { int abs(int); }
> using std::abs;  // this in effect seems to 'finalize' abs are visible in ::
> namespace std { double abs(double); }
> using std::abs;  // this does not make abs(double) visable in ::
> int main () { double d = abs (0.1234); }  //  calls ::abs(int);
> 
> but clearly (I think) based on 7.3.3, this is wrong and the second using
> std::abs should make ::abs(double) visable.
 
I agree this is a compiler bug.  However, I think the sequence

  using std::abs;
  using std::abs;

is not legal C++; hence my suggested #ifdefs.  

I have submitted a bug report to gcc-bugs about overload
resolution failing to find the second abs().

Nathan Myers
ncm at cantrip dot org



More information about the Libstdc++ mailing list