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++/81587] GCC doesn't warn about calling functions that don't exist


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81587

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #1)
> These are declarations of nested functions, you're not using them. 

Actually they are not nested functions but rather considered part of the
namespace that the function is enclosed in.  That is they reference functions
that are part of that namespace.  Like:

Assuming C++:
int f(void){return 1;}

int g(void)
{
  int f(int);  // Here f refers to ::f(int)
  return f(1);  // Here f refers to ::f(int) rather than the above function
::f(void);
}

---- CUT ----
This is valid and well defined code if int f(int); is defined in a different
translation unit.

Now GCC should warn about this code but that is a different issue.

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