This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/13264] Function name completely hides struct in outer scope


------- Additional Comments From bangerth at dealii dot org  2003-12-01 22:36 -------
What really happens is this: gcc sees something like this
---------------------
namespace posix {
  int stat(double);
}

int posix::stat(int);
----------------------
i.e. two functions stat with different argument lists. That's not allowed,
though: a function declaration is only allowed from within the namespace.
So the error message you get is actually accurate:

g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
x.cc:5: error: `int posix::stat(int)' should have been declared inside `posix'

The only thing is that it gets a little confusing with names of
functions and structures being the same. The icc message, btw, has
exactly the same meaning.

W.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13264


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]