public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/109110] New: Function Declaration Syntax errors at callsite
@ 2023-03-13 15:47 bthomas at brave dot com
  2023-03-13 15:50 ` [Bug c/109110] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: bthomas at brave dot com @ 2023-03-13 15:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109110
           Summary: Function Declaration Syntax errors at callsite
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bthomas at brave dot com
  Target Milestone: ---

https://godbolt.org/z/Y8rbd35xP

```C
void func1(a)
int a[];
{
}

void func2(int a[])
{
}

int main(void) {
    Foo f;

    func1(f);
    func1(1.0);

    func2(f);
    func2(1.0);
        return 0;
}
```

These two Syntax for declaring a function works fine, however they behave
completely different.

`func2` gives compilation errors:

```
error: incompatible type for argument 1 of 'func2'
expected 'int *' but argument is of type 'Foo'
expected 'int *' but argument is of type 'double'
```

However, `func1` compiles and runs just fine. In fact, if I put a printf to
print the argument, `func1` will also give no warnings even with `-Werror`
unless I explicitly specific `-Wformat`, but `func2` will.

in Clang, all of the above gives both errors and warnings and won't compile.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-03-13 16:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-13 15:47 [Bug c/109110] New: Function Declaration Syntax errors at callsite bthomas at brave dot com
2023-03-13 15:50 ` [Bug c/109110] " pinskia at gcc dot gnu.org
2023-03-13 15:51 ` pinskia at gcc dot gnu.org
2023-03-13 15:58 ` [Bug c/109110] old style function declaration not causing incompatible type on calls jakub at gcc dot gnu.org
2023-03-13 15:59 ` schwab@linux-m68k.org
2023-03-13 16:04 ` mpolacek at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).