Title
Parameter type determination still not clear enough
Status
drafting
Section
9.3.4.6 [dcl.fct]
Submitter
Daniel Krügler

Created on 2013-04-25.00:00:00 last changed 134 months ago

Messages

Date: 2014-03-03.00:00:00

According to 9.3.4.6 [dcl.fct] paragraph 5,

The type of a function is determined using the following rules. The type of each parameter (including function parameter packs) is determined from its own decl-specifier-seq and declarator. After determining the type of each parameter, any parameter of type “array of T” or “function returning T” is adjusted to be “pointer to T” or “pointer to function returning T,” respectively. After producing the list of parameter types, any top-level cv-qualifiers modifying a parameter type are deleted when forming the function type. The resulting list of transformed parameter types and the presence or absence of the ellipsis or a function parameter pack is the function's parameter-type-list. [Note: This transformation does not affect the types of the parameters. For example, int(*)(const int p, decltype(p)*) and int(*)(int, const int*) are identical types. —end note]

This is not sufficiently clear to specify the intended handling of an example like

  void f(int a[10], decltype(a) *p );

Should the type of p be int(*)[10] or int**? The latter is the intended result, but the phrase “after determining the type of each parameter” makes it sound as if the adjustments are performed after all the parameter types have been determined from the decl-specifier-seq and declarator instead of for each parameter individually.

See also issue 1444.

History
Date User Action Args
2013-10-14 00:00:00adminsetstatus: open -> drafting
2013-04-25 00:00:00admincreate