Title
trailing-return-type no longer ambiguous
Status
cd4
Section
9.3 [dcl.decl]
Submitter
Jens Maurer

Created on 2014-11-09.00:00:00 last changed 86 months ago

Messages

Date: 2015-09-15.00:00:00

Proposed resolution (September, 2015):

Delete 9.3 [dcl.decl] paragraph 5:

The optional attribute-specifier-seq in a trailing-return-type appertains to the indicated return type. The type-id in a trailing-return-type includes the longest possible sequence of abstract-declarators. [Note: This resolves the ambiguous binding of array and function declarators. [Example:

  auto f()->int(*)[4]; // function returning a pointer to array[4] of int
                       // not function returning array[4] of pointer to int

end example] —end note]

Date: 2016-02-15.00:00:00

[Adopted at the February, 2016 meeting.]

According to 9.3 [dcl.decl] paragraph 5,

The type-id in a trailing-return-type includes the longest possible sequence of abstract-declarators. [Note: This resolves the ambiguous binding of array and function declarators. [Example:

  auto f()->int(*)[4]; // function returning a pointer to array[4] of int
                       // not function returning array[4] of pointer to int

end example] —end note]

However, the grammar has changed since that rule and example were added; because trailing-return-type can only appear at the top level, there is no longer any potential ambiguity.

History
Date User Action Args
2017-02-06 00:00:00adminsetstatus: tentatively ready -> cd4
2015-11-10 00:00:00adminsetmessages: + msg5601
2015-11-10 00:00:00adminsetstatus: drafting -> tentatively ready
2014-11-09 00:00:00admincreate