public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107178] New: Diagnosis for colon vs semi-colon in a member function declaration
@ 2022-10-07  3:08 llvm at rifkin dot dev
  2022-10-07  3:22 ` [Bug c++/107178] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: llvm at rifkin dot dev @ 2022-10-07  3:08 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107178
           Summary: Diagnosis for colon vs semi-colon in a member function
                    declaration
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: llvm at rifkin dot dev
  Target Milestone: ---

The following code emits a poor diagnosis:

struct T {};

struct S {
    T foo():
};

<source>:4:7: error: bit-field 'T S::foo()' has non-integral type 'T (S::)()'
    4 |     T foo():
      |       ^~~

https://godbolt.org/z/39ME3K6TE

At least for the case of a member function declaration, a better diagnosis
would probably be ideal.


For T foo():, clang emits:

<source>:5:1: error: expected '(' or '{'
};
^


For T foo:, clang emits:

<source>:5:1: error: expected expression
};
^
<source>:5:3: error: expected '}'
};
  ^
<source>:3:10: note: to match this '{'
struct S {
         ^
<source>:5:3: error: expected ';' after struct
};
  ^
  ;

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

end of thread, other threads:[~2022-10-07  8:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-07  3:08 [Bug c++/107178] New: Diagnosis for colon vs semi-colon in a member function declaration llvm at rifkin dot dev
2022-10-07  3:22 ` [Bug c++/107178] " pinskia at gcc dot gnu.org
2022-10-07  3:59 ` llvm at rifkin dot dev
2022-10-07  8:12 ` redi at gcc dot gnu.org
2022-10-07  8:27 ` redi at gcc dot gnu.org
2022-10-07  8:28 ` 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).