This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/66606] missing diagnostic on using function main
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 19 Jun 2015 20:28:07 +0000
- Subject: [Bug c++/66606] missing diagnostic on using function main
- Auto-submitted: auto-generated
- References: <bug-66606-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66606
--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
One other observation (and actually the reason why I found this problem) is
that the diagnostic GCC issues for the call to main in bar:
int bar () { return main (); }
is misleading. The operand of the return statement is a call to main, not an
ADDR_EXPR. (It just happens to be easy to handle both in cp_build_addr_expr_1
because it doesn't distinguish between the two.) The Clang diagnostic doesn't
suffer from the same problem (and so can be used in all other contexts.)