"exit" etc. improperly visible

Nathan Myers ncm@cygnus.com
Mon Oct 5 18:53:00 GMT 1998


(Apologies to those who have seen this before.  I can't
find where I posted it.)

Egcs-1.1 and recent snapshots treat some names specially,
and wrong.  In the example below, only std::exit is visible.

Incidentally, overload candidates would be most-usefully
reported with their enclosing namespace prepended.

Nathan Myers
ncm@cygnus.com

----------------------------------------------
$ egcs -fnew-abi -c visbug.cc
visbug.cc: In function `int main()':
visbug.cc:18: call of overloaded `exit (int)' is ambiguous
<internal>:18: candidates are: exit(int)
visbug.cc:11:                 exit(int)
----------------------------------------------
namespace Hidden {
  extern "C" {
    extern void other();
    extern void exit(int);
  }
}

namespace std {
  inline void other() { ::Hidden::other(); }
  inline void exit(int i) { ::Hidden::exit(i); }
}

int main()
{
  using namespace std;
  other();  // OK
  exit(0);  // Egcs complains.
}



More information about the Gcc mailing list