[C++ PATCH] Fix main return type checking (PR c++/29735)

Jakub Jelinek jakub@redhat.com
Tue Nov 21 17:57:00 GMT 2006


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



More information about the Gcc-patches mailing list