Title
Function parameter type adjustments and decltype
Status
c++11
Section
9.2.9.3 [dcl.type.simple]
Submitter
US

Created on 2010-08-02.00:00:00 last changed 131 months ago

Messages

Date: 2010-11-15.00:00:00

[Voted into the WP at the November, 2010 meeting.]

Date: 2010-08-15.00:00:00

Proposed resolution (August, 2010):

Change 9.3.4.6 [dcl.fct] paragraph 5 as follows:

...After producing the list of parameter types, several transformations take place upon these types to determine the function type. Any any top-level cv-qualifiers modifying a parameter type is are deleted when forming the function type. [Example: the type void(*)(const int) becomes void(*)(int)end example] Such cv-qualifiers affect only the definition of the parameter within the body of the function; they do not affect the function type. If a storage-class-specifier modifies a parameter type, the specifier is deleted. [Example: register char* becomes char*end example] Such storage-class-specifiers affect only the definition of the parameter within the body of the function; they do not affect 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]
Date: 2010-08-02.00:00:00
N3092 comment US 40

The description of decltype does not specify whether the type of a parameter is the declared type or the type as adjusted in 9.3.4.6 [dcl.fct] paragraph 5:

    auto f(int a[])->decltype(a);     // ill-formed or int*?
    auto g(const int i)->decltype(i); // int or const int?

Suggested resolution: Clarify the wording to indicate that the type of a parameter is after the array- and function-to-pointer decay but before the removal of cv-qualification.

History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: fdis -> c++11
2011-04-10 00:00:00adminsetstatus: dr -> fdis
2010-11-29 00:00:00adminsetmessages: + msg3165
2010-11-29 00:00:00adminsetstatus: ready -> dr
2010-08-23 00:00:00adminsetmessages: + msg2779
2010-08-02 00:00:00admincreate