https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97986

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jsm28 at gcc dot gnu.org

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
We end up gimplifying

    int * input = SAVE_EXPR <n>, (int *) &VA_ARG_EXPR <&ap>;

I think this is garbage coming from the frontend which should either
reject this as comment#1 says or in case the rvalue should be produced
use a TARGET_EXPR for the purpose of address-taking and array-to-pointer
decay.

The case of a function type (which would decay to a pointer as well) is
rejected:

In file included from t.c:1:
t.c:7:29: error: second argument to ‘va_arg’ is a function type ‘int(void)’
    7 |     int *input = va_arg(ap, int()(int));
      |                             ^~~

and clang says

t.c:7:32: error: function cannot return function type 'int (int)'
    7 |     int *input = va_arg(ap, int()(int));
      |                                ^

but a function can also not return an array type.

Reply via email to