This is the mail archive of the
mailing list for the GCC project.
Re: [C++ PATCH] Fix main return type checking (PR c++/29735)
Jakub Jelinek wrote:
>> Then, move the check for valid
>> "main" (not just the return type, but all of those checks) after attributes.
> This is a problem, since some of the "main" checks set publicp and inlinep
> and a whole bunch of things use those 2 in between the current "main" checks
> and if (check < 0). The check_main_parameter_types call can be moved to
> where I had the "main" return type check though.
OK, that makes sense. My feeling is that the return type and parameter
types should be checked at the same point. It is reasonable to check
for the inline/static stuff earlier.
> Unfortunately, even this doesn't work, as shown on
> When check_explicit_specialization call is swapped with
> cplus_decl_attributes in grokfndecl, e.g. _Z8identityIdET_S0_
> is not hidden anymore.
Ugh. That just means that there's another bug in attribute-handling
with templates, which isn't surprising, since the attribute semantics
have historically been so poorly thought through.
However, in the present context, it's OK with me to move the main
return/parameter checks after the attribute application in grokfndecl,
which should fix the bug in the PR, without tackling this other problem.
(650) 331-3385 x713