public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/113839] New: misleading syntax error message
@ 2024-02-08 19:02 f.heckenbach@fh-soft.de
  2024-02-08 19:05 ` [Bug c++/113839] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: f.heckenbach@fh-soft.de @ 2024-02-08 19:02 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113839
           Summary: misleading syntax error message
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: f.heckenbach@fh-soft.de
  Target Milestone: ---

% cat test.cpp
void f ()
{
  static int { };
}
% g++ test.cpp
test.cpp: In function 'void f()':
test.cpp:3:3: error: expected primary-expression before 'static'
    3 |   static int { };
      |   ^~~~~~

This message is clearly misleading. There is nothing missing before "static",
but rather the variable name after "int" is missing.

I seem to get a lot of such confusing messages, to the point I tend to ignore
the wording of the messages and treat them as generic "syntax error" messages,
which is sad.

While I appreciate gcc trying to by helpful, it seems it goes wrong rather
often. I'd prefer if gcc (by default, or at least optional) would limit itself
to reporting actual errors if and when they occur. (In this case, the program
is correct up to and including "static int", so there shouldn't be any error
reported on that part.)

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

end of thread, other threads:[~2024-02-08 20:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-08 19:02 [Bug c++/113839] New: misleading syntax error message f.heckenbach@fh-soft.de
2024-02-08 19:05 ` [Bug c++/113839] " pinskia at gcc dot gnu.org
2024-02-08 19:06 ` mpolacek at gcc dot gnu.org
2024-02-08 19:17 ` f.heckenbach@fh-soft.de
2024-02-08 20:22 ` redi at gcc dot gnu.org
2024-02-08 20:29 ` redi 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).