This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] Fix main return type checking (PR c++/29735)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: Jason Merrill <jason at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 21 Nov 2006 12:55:11 -0500
- Subject: Re: [C++ PATCH] Fix main return type checking (PR c++/29735)
- References: <20061121172742.GM6570@devserv.devel.redhat.com> <45633895.4050601@codesourcery.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Nov 21, 2006 at 09:34:13AM -0800, Mark Mitchell wrote:
> Jakub Jelinek wrote:
> >
> > 2006-11-21 Jakub Jelinek <jakub@redhat.com>
> >
> > PR c++/29735
> > * decl.c (grokfndecl): Check main's return type after applying
> > attributes, not before.
>
> Good analysis.
>
> I'm concerned, though; mightn't attributes change parameter types as
> well?
There is no attribute that would change that. The only attributes
that touch arguments of types in their handle_* routines are
nonnull and sentinel, but in both cases they read them only to
perform diagnostics and the attribute is kept in DECL_ATTRIBUTE on
the function. If you mean attributes on the arguments, those are
applied and resolved already before entering grokfndecl.
> And, I see that we check for explicit specialization before
> applying attributes; should we worry that we'll not match templates
> correctly because the types haven't yet been attributified?
Does check_explicit_specialization ever care about the return type?
Perhaps when cloning, but it clones only constructors and destructors,
neither of which should have vector_size attributed return type.
In any case, perhaps swapping the check_explicit_specialization
and cplus_decl_attributes calls in grokfndecl wouldn't be a bad idea.
Jakub