This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 114a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-04-18


1725. Trailing return type with nested function declarator

Section: 9.2.9.7  [dcl.spec.auto]     Status: NAD     Submitter: Richard Smith     Date: 2013-08-01

The treatment of a declaration like the following is not clear:

   auto (*f())() -> int; // #1

9.3.4.6 [dcl.fct] paragraph 2 appears to require determining the type of the nested declarator

   auto (*f()); // #2

which, because it does not have a trailing-return-type, would be ill-formed by (C++11) 9.2.9.7 [dcl.spec.auto]. (In C++14, an auto return type without a trailing-return-type is, of course, permitted.)

Rationale (September, 2013):

The intent of the C++11 wording is that the requirement for a trailing return type applies only at the top level of the declarator to which auto applies, not to each possible recursive stage in the declarator processing. Also, as noted, the issue becomes moot with the changes enabling return type deduction.