Edit after @Xeo constructive comments:
This problem seems to be caused by a contradiction between the two places of the draft standard.
In accordance with the draft standard ยง 7.1.6.4, the auto-specialist [dcl.spec.auto]:
1 Type decltype(auto) auto and decltype(auto) indicate the type of placeholder , which will be replaced later either by subtraction from the initializer, or by explicit specification using the trailing-return-type function. An autotype specifier is also used to indicate that lambda is a common lambda.
2 A placeholder type may appear with a function declaration in the declaration-specifier-seq, type-specifier-seq, convert-function-id or trailing-return-type , in any context where such a declarator is valid. If the declarator function includes a type trailing-return-type (8.3.5), which sets the declared return type of the function. If the declared return type of the function contains a placeholder type, the return type of the function is derived from the return statements in the function body, if any.
A single interpretation of the foregoing suggests that the Clan has a mistake.
However, since the main problem of 1852 indicates that the above is a contradiction with ยง 8.3.5 / 2 Functions [dcl.fct] and must be changed, the status of the problem is ready, which suggests that the changes have been accepted.
Therefore, the GCC has an error that should be reported.
source share