Title
Use of auto in function type
Status
cd4
Section
9.2.9.7 [dcl.spec.auto]
Submitter
Richard Smith

Created on 2014-03-12.00:00:00 last changed 86 months ago

Messages

Date: 2014-11-15.00:00:00

[Moved to DR at the November, 2014 meeting.]

Date: 2014-06-15.00:00:00

Proposed resolution (June, 2014):

Change 9.2.9.7 [dcl.spec.auto] paragraph 2 as follows:

The placeholder type can appear with a function declarator in the decl-specifier-seq, type-specifier-seq, conversion-function-id, or trailing-return-type, in any context where such a declarator is valid. If the function declarator includes a trailing-return-type (9.3.4.6 [dcl.fct]), that specifies the declared return type of the function. Otherwise, the function declarator shall declare a function. If the declared return type of the function contains a placeholder type, the return type of the function is deduced from return statements in the body of the function, if any.
Date: 2014-07-07.00:00:00

There appear to be no restrictions against using the auto specifier in examples like the following:

  template<typename T> using X = T;
  X<auto()> f_with_deduced_return_type; // ok
  std::vector<auto(*)()> v; // ok?!
  void f(auto (*)()); // ok?!
History
Date User Action Args
2017-02-06 00:00:00adminsetstatus: drwp -> cd4
2015-05-25 00:00:00adminsetstatus: dr -> drwp
2015-04-13 00:00:00adminsetmessages: + msg5365
2014-11-24 00:00:00adminsetstatus: ready -> dr
2014-07-07 00:00:00adminsetmessages: + msg5068
2014-07-07 00:00:00adminsetstatus: open -> ready
2014-03-12 00:00:00admincreate