[Bug c++/55002] trailing return type is rejected in function signature

daniel.kruegler at googlemail dot com gcc-bugzilla@gcc.gnu.org
Sat Oct 20 20:24:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55002

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler at
                   |                            |googlemail dot com

--- Comment #2 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2012-10-20 20:24:19 UTC ---
Your issue looks invalid to me, because you are never providing a pointer to
function declarator. 

Lets look first at your simplified example:

auto (*ff) -> int (int)

This would be an invalid function declarator, because there is (a) no parameter
list and (b) the return type is a function type int(int), which is never
possible. I can only assume you mean

int f(auto (*ff)(int) -> int) {
  return ff(1);
}

and this is accepted. 

A similar defect is in your original code, where the only valid form would be

template<class T, size_t N> size_t   
apply (const T (&A)[N], auto (*f)(const T (&)[N]) -> size_t)
{ return   f(A); }


which is also accepted.



More information about the Gcc-bugs mailing list