Is the new C++ return syntax limited?

The reason for the problem is that noexcept is part of the function declarator (and proposed to be part of the function type in C++17), while override is an (optionally used) identifier that is not part of the function declarator.

Hence, without use of override the declaration would be

virtual auto what() const noexcept -> const char *;

and, since override must appear after this declaration, it will result in

virtual auto what() const noexcept -> const char * override;

That said, rather than slavishly using C++11/C++14 features, pick the ones which best reflect your intent. There is not some rule that requires only use of C++11/C++14 features if there are older alternatives to achieve the same thing.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)