This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/81587] GCC doesn't warn about calling functions that don't exist
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 27 Jul 2017 20:42:21 +0000
- Subject: [Bug c++/81587] GCC doesn't warn about calling functions that don't exist
- Auto-submitted: auto-generated
- References: <bug-81587-4@http.gcc.gnu.org/bugzilla/>
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.