public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Buggy error message when dereferencing once a double pointer to struct
@ 2022-05-23 16:43 Andrea Monaco
  2022-05-23 16:47 ` Marek Polacek
  0 siblings, 1 reply; 2+ messages in thread
From: Andrea Monaco @ 2022-05-23 16:43 UTC (permalink / raw)
  To: gcc


This snippet that I wrote


  struct
  str
  {
    int val;
  };  


  void
  main (int argc, char **argv)
  {
    struct str **p;
    int i;
  
    i = p->val;
  }


is obviously incorrect.  But gcc 8.3.0 says

  pointer.c: In function ‘main’:
  pointer.c:14:8: error: ‘*p’ is a pointer; did you mean to use ‘->’?
     i = p->val;
          ^~
          ->

which seems a buggy error message to me: I wrote "p", not "*p"; also the
compiler suggests replacing "->" with itself.



Andrea Monaco




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

end of thread, other threads:[~2022-05-23 16:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-23 16:43 Buggy error message when dereferencing once a double pointer to struct Andrea Monaco
2022-05-23 16:47 ` Marek Polacek

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).