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

            Bug ID: 103824
           Summary: Enum class shadowed by class member in
                    using-enum-declaration
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: luizfvalle at pm dot me
  Target Milestone: ---

Created attachment 52056
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52056&action=edit
Input file (test.cpp)

A global enum class is shadowed by a class member of the same name in a
using-enum-declaration. Lookup finds the enum class correctly when referred
outside the using-enum-declaration.

Command and error:
g++ -std=c++20 -c test.cpp
test.cpp: In member function ‘void C::F()’:
test.cpp:7:20: error: ‘E’ is not a type
    7 |         using enum E;
      |              

System type: x86_64-pc-linux-gnu     

All options given when GCC was configured/built:
--prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --with-isl
--with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit
--enable-cet=auto --enable-checking=release --enable-clocale=gnu
--enable-default-pie --enable-default-ssp --enable-gnu-indirect-function
--enable-gnu-unique-object --enable-install-libiberty --enable-linker-build-id
--enable-lto --enable-multilib --enable-plugin --enable-shared
--enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-libunwind-exceptions --disable-werror
gdc_include_dir=/usr/include/dlang/gdc

Error also happens in godbolt.org's trunk build, and is absent from other
compilers.

Reply via email to