vendredi 27 mai 2016

Is this trailing return type legal in C++11?

The following:

auto (*f())() -> int;

gives an error in C++11 mode for Clang saying:

error: 'auto' return without trailing return type; deduced return types are a C++14 extension

but compiles in C++14 mode. GCC compiles without complaining in both modes with -Wall -Wextra -pedantic.

n3337 7.1.6.4/2 says:

The auto type-specifier may appear with a function declarator with a trailing-return-type (8.3.5) in any context where such a declarator is valid.

8.3.5p2 talks about function declarators but I'm too dumb to figure it out. Can anyone explain if it's legal in C++11?

Aucun commentaire:

Enregistrer un commentaire