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

            Bug ID: 117866
           Summary: Confusing 'expected ... but argument is of type ...'
                    (same type repeated)
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
  Target Milestone: ---

Created attachment 59758
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59758&action=edit
path.i.xz

Pretty sure I've made an error here but the diagnostic is weird either way:
```
# gcc paths.i -fmax-errors=1
paths.c: In function ‘t1_Loc’:
paths.c:219:22: error: passing argument 1 of ‘S->convert’ from incompatible
pointer type [-Wincompatible-pointer-types]
  219 |        (*S->convert)(&r->dest, S, x, y);
      |                      ^~~~~~~~
      |                      |
      |                      struct fractpoint *
paths.c:219:22: note: expected ‘struct fractpoint *’ but argument is of type
‘struct fractpoint *’
compilation terminated due to -fmax-errors=1.
```

"expected 'struct X *' but argument is of type 'struct X *'

It's the same type according to the text?

If I build it with Clang, I get a warning which makes way more sense at least:
```
./spaces.h:63:31: warning: declaration of 'struct fractpoint' will not be
visible outside of this function [-Wvisibility]
   63 |        void (*convert)(struct fractpoint *pt, struct XYspace *S, float
X, float Y);     /* calculate "fractpoint" X,Y from float X,Y    */
      |                               ^
./spaces.h:64:32: warning: declaration of 'struct fractpoint' will not be
visible outside of this function [-Wvisibility]
   64 |        void (*iconvert)(struct fractpoint *pt, struct XYspace *S, int
X, int Y);    /* calculate "fractpoint" X,Y from int X,Y      */
      |                             
```

Reply via email to