public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104398] New: [c++20] ICE triggered by templated class with base class containing `using enum`
@ 2022-02-05 14:56 doodspav at gmail dot com
  2022-02-06  1:24 ` [Bug c++/104398] " pinskia at gcc dot gnu.org
  2022-10-30 18:55 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: doodspav at gmail dot com @ 2022-02-05 14:56 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104398
           Summary: [c++20] ICE triggered by templated class with base
                    class containing `using enum`
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: doodspav at gmail dot com
  Target Milestone: ---

This code triggers an internal compiler error:

------------------------------------------------
struct E {
    enum class type : unsigned char { UNKNOWN };
};

struct T {
    using enum E::type;
};

template <int N>
struct U : T
{
    int ice(int x) {
        return static_cast<int>(UNKNOWN);
    }
};

int main() {

    U<3>().ice(3);
}
------------------------------------------------

Using built-in specs.
COLLECT_GCC=g++-11
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
11.1.0-1ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-11
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib
--enable-libphobos-checking=release --with-target-system-zlib=auto
--enable-objc-gc=auto --enable-multiarch --disable-werror --disable-cet
--with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none=/build/gcc-11-2V7zgg/gcc-11-11.1.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-2V7zgg/gcc-11-11.1.0/debian/tmp-gcn/usr
--without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
--with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.1.0 (Ubuntu 11.1.0-1ubuntu1~20.04) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++20' '-shared-libgcc'
'-mtune=generic' '-march=x86-64' '-dumpdir' 'a-'
 /usr/lib/gcc/x86_64-linux-gnu/11/cc1plus -E -quiet -v -imultiarch
x86_64-linux-gnu -D_GNU_SOURCE using_enum.cpp -mtune=generic -march=x86-64
-std=c++20 -fpch-preprocess -fasynchronous-unwind-tables
-fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection
-fcf-protection -o a-using_enum.ii
ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/11"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/11/include-fixed"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/11
 /usr/include/x86_64-linux-gnu/c++/11
 /usr/include/c++/11/backward
 /usr/lib/gcc/x86_64-linux-gnu/11/include
 /usr/local/include
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++20' '-shared-libgcc'
'-mtune=generic' '-march=x86-64' '-dumpdir' 'a-'
 /usr/lib/gcc/x86_64-linux-gnu/11/cc1plus -fpreprocessed a-using_enum.ii -quiet
-dumpdir a- -dumpbase using_enum.cpp -dumpbase-ext .cpp -mtune=generic
-march=x86-64 -std=c++20 -version -fasynchronous-unwind-tables
-fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection
-fcf-protection -o a-using_enum.s
GNU C++20 (Ubuntu 11.1.0-1ubuntu1~20.04) version 11.1.0 (x86_64-linux-gnu)
        compiled by GNU C version 11.1.0, GMP version 6.2.0, MPFR version
4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++20 (Ubuntu 11.1.0-1ubuntu1~20.04) version 11.1.0 (x86_64-linux-gnu)
        compiled by GNU C version 11.1.0, GMP version 6.2.0, MPFR version
4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 7a79b9a038c6e5e716b693fdb4982943
using_enum.cpp: In instantiation of ‘int U<N>::ice(int) [with int N = 3]’:
using_enum.cpp:19:15:   required from here
using_enum.cpp:13:16: internal compiler error: in tsubst_copy, at cp/pt.c:16715
   13 |         return static_cast<int>(UNKNOWN);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~
0xe306b3 internal_error(char const*, ...)
        ???:0
0xe27039 fancy_abort(char const*, int, char const*)
        ???:0
0x10ed884 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ???:0
0x10eddd9 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ???:0
0x1178f37 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ???:0
0x11790e8 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ???:0
0x1178f95 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ???:0
0x122150a instantiate_decl(tree_node*, bool, bool)
        ???:0
0xfa3850 instantiate_pending_templates(int)
        ???:0
0xf9f8f3 c_parse_final_cleanups()
        ???:0
Please submit a full bug report


System is x86_64 Intel running Ubuntu 20.04.3 LTS


Potentially related bug report:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103081
(but it has a different stack trace, so not sure if it's the same bug).

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

* [Bug c++/104398] [c++20] ICE triggered by templated class with base class containing `using enum`
  2022-02-05 14:56 [Bug c++/104398] New: [c++20] ICE triggered by templated class with base class containing `using enum` doodspav at gmail dot com
@ 2022-02-06  1:24 ` pinskia at gcc dot gnu.org
  2022-10-30 18:55 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-06  1:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-02-06
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=103081

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c++/104398] [c++20] ICE triggered by templated class with base class containing `using enum`
  2022-02-05 14:56 [Bug c++/104398] New: [c++20] ICE triggered by templated class with base class containing `using enum` doodspav at gmail dot com
  2022-02-06  1:24 ` [Bug c++/104398] " pinskia at gcc dot gnu.org
@ 2022-10-30 18:55 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-30 18:55 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 103081.

*** This bug has been marked as a duplicate of bug 103081 ***

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

end of thread, other threads:[~2022-10-30 18:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-05 14:56 [Bug c++/104398] New: [c++20] ICE triggered by templated class with base class containing `using enum` doodspav at gmail dot com
2022-02-06  1:24 ` [Bug c++/104398] " pinskia at gcc dot gnu.org
2022-10-30 18:55 ` 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).