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

            Bug ID: 117391
           Summary: wrong composite for unspecified sizes
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: uecker at gcc dot gnu.org
  Target Milestone: ---

In the following example, the composite type is always the first in the
conditional operator while it should be the one without the unspecified size. 
This can only be seen in the type used for the error but should otherwise have
no consequence.

int foo(int n, char (*buf)[*]);
int bar(int n, char (*buf)[n]);

void test()
{
        (1 ? foo : bar)(0);
        (0 ? bar : foo)(0);
}

c.c: In function ‘test’:
c.c:7:18: error: too few arguments to function ‘foo’
    7 |         (1 ? foo : bar)(0);
      |         ~~~~~~~~~^~~~~~
c.c:8:18: error: too few arguments to function ‘(int (*)(int,  char
(*)[n]))&foo’
    8 |         (0 ? bar : foo)(0);
      |         ~~~~~~~~~^~~~~~

Reply via email to