public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102898] New: declaration of 'using Foo = enum class Foo' changes meaning of 'Foo'
@ 2021-10-22 15:04 roehling at debian dot org
  2021-10-22 18:46 ` [Bug c++/102898] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: roehling at debian dot org @ 2021-10-22 15:04 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102898
           Summary: declaration of 'using Foo = enum class Foo' changes
                    meaning of 'Foo'
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: roehling at debian dot org
  Target Milestone: ---

The following C++ code fails to compile:

    enum class Foo { foo };

    class Bar
    {
        using Foo = Foo;
    };

The generated error is

    <source>:5:11: error: declaration of 'using Foo = enum class Foo' changes
meaning of 'Foo' [-fpermissive]
        5 |     using Foo = Foo;
          |           ^~~
    <source>:1:12: note: 'Foo' declared here as 'enum class Foo'
        1 | enum class Foo { foo };
          |            ^~~


The code does compile with

    using Baz = Foo;

or

    using Foo = enum Foo;

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

* [Bug c++/102898] declaration of 'using Foo = enum class Foo' changes meaning of 'Foo'
  2021-10-22 15:04 [Bug c++/102898] New: declaration of 'using Foo = enum class Foo' changes meaning of 'Foo' roehling at debian dot org
@ 2021-10-22 18:46 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-22 18:46 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
GCC is correct in this error message.
The (current) C++ standard requires no diagnostic on this though.

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

end of thread, other threads:[~2021-10-22 18:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-22 15:04 [Bug c++/102898] New: declaration of 'using Foo = enum class Foo' changes meaning of 'Foo' roehling at debian dot org
2021-10-22 18:46 ` [Bug c++/102898] " pinskia 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).