public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95641] New: Bogus error message in the class base specifier
@ 2020-06-11 15:26 haoxintu at gmail dot com
  2020-06-11 15:31 ` [Bug c++/95641] " redi at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: haoxintu at gmail dot com @ 2020-06-11 15:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95641
           Summary: Bogus error message in the class base specifier
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haoxintu at gmail dot com
  Target Milestone: ---

This code bug.cc

class A {};
class B : virtual class A{};

In gcc-trunk

$g++ -c bug.cc
bug.cc:2:19: error: expected class-name before ‘class’
    2 | class B : virtual class A{};
      |                   ^~~~~
bug.cc:2:19: error: expected ‘{’ before ‘class’
bug.cc:2:25: error: redefinition of ‘class A’
    2 | class B : virtual class A{};
      |                         ^
bug.cc:1:7: note: previous definition of ‘class A’
    1 | class A {};
      |       ^
bug.cc:2:1: error: multiple types in one declaration
    2 | class B : virtual class A{};
      | ^~~~~

There are four error messages, I guess some of them are bogus.

I tested bug.cc in other compilers, and they only give one message.

In clang : "error: expected class name",
In icc : "error: expected an identifier",
In msvc : " error C2518: keyword 'class' is invalid in a base class list;
expected a class name".

Reproduced in Godbolt : https://godbolt.org/z/KuEPNF

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

* [Bug c++/95641] Bogus error message in the class base specifier
  2020-06-11 15:26 [Bug c++/95641] New: Bogus error message in the class base specifier haoxintu at gmail dot com
@ 2020-06-11 15:31 ` redi at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2020-06-11 15:31 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |diagnostic
   Last reconfirmed|                            |2020-06-11
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Haoxin Tu from comment #0)
> There are four error messages, I guess some of them are bogus.

The parser gets confused after the first one.

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

end of thread, other threads:[~2020-06-11 15:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-11 15:26 [Bug c++/95641] New: Bogus error message in the class base specifier haoxintu at gmail dot com
2020-06-11 15:31 ` [Bug c++/95641] " 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).