New Function Declarator Syntax Wording

Jason Merrill
2007-10-06
Document Number N2445=07-0315
Revision 6

7.1.6.4p2+

Otherwise (auto appearing with no type specifiers other than cv-qualifiers), the auto type-specifier signifies that the type of an object being declared shall be deduced from its initializer or specified explicitly at the end of a function declarator. The name of the object being declared shall not appear in the initializer expression.

auto can appear with a function declarator with a late-specified return type (8.3.5) in any context where such a declarator is valid, and the use of auto is replaced by the late-specified return type.

Otherwise, the type of the object is deduced from its initializer. The name of the object being declared shall not appear in the initializer expression. This use of auto is allowed when declaring objects in a block (6.3), in namespace scope (3.3.5), and in a for-init-statement (6.5.3). [...]

8p4

direct-declarator:
	declarator-id
	direct-declarator ( parameter-declaration-clause ) cv-qualifier-seqopt ref-qualifieropt exception-specificationopt
	direct-declarator ( parameter-declaration-clause ) cv-qualifier-seqopt ref-qualifieropt exception-specificationopt -> type-id
	direct-declarator [ constant-expressionopt ]
	( declarator )

8.1p1

direct-abstract-declarator:
	direct-abstract-declaratoropt
	( parameter-declaration-clause ) cv-qualifier-seqopt ref-qualifieropt exception-specificationopt
	( parameter-declaration-clause ) cv-qualifier-seqopt ref-qualifieropt exception-specificationopt -> type-id
	direct-abstract-declaratoropt [ constant-expressionopt ]
	( abstract-declarator )

8.3.5p1

In a declaration T D where D has the form

D1 ( parameter-declaration-clause ) cv-qualifier-seqopt exception-specificationopt
and the type of the contained declarator-id in the declaration T D1 is "derived-declarator-type-list T," the type of the declarator-id in D is "derived-declarator-type-list function of (parameter-declaration-clause) cv-qualifier-seqopt returning T"; a type of this form is a function type*.

In a declaration T D where D has the form

D1 ( parameter-declaration-clause ) cv-qualifier-seqopt exception-specificationopt -> type-id
and the type of the contained declarator-id in the declaration T D1 is "derived-declarator-type-list T," obtain P from T by replacing auto with the type-id. Then the type of the declarator-id in D is "derived-declarator-type-list function of (parameter-declaration-clause) cv-qualifier-seqopt returning P". auto shall occur exactly once in T. The type-id is a late-specified return type.

A type of either form is a function type*.

[Footnote: As indicated by the syntax, cv-qualifiers are a significant component in function return types. --- end foonote]