public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/99968] New: [11 Regression] ICE on remove_const_t<incomplete enum type> in requires-expression Date: Thu, 08 Apr 2021 10:37:57 +0000 [thread overview] Message-ID: <bug-99968-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99968 Bug ID: 99968 Summary: [11 Regression] ICE on remove_const_t<incomplete enum type> in requires-expression Product: gcc Version: 11.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- template<typename T> struct remove_const { using type = T; }; template<typename T> struct remove_const<const T> { using type = T; }; template<typename T> using remove_const_t = typename remove_const<T>::type; template<typename T> constexpr inline bool is_enum_v = __is_enum(T); template<typename T> struct is_scoped_enum { static constexpr bool value = false; }; template<typename T> requires is_enum_v<T> && requires (remove_const_t<T> t) { t = t; } struct is_scoped_enum<T> { static constexpr bool value = !requires (T t, int i) { i = t; }; }; template<typename T> constexpr inline bool is_scoped_enum_v = is_scoped_enum<T>::value; void f() { enum E { e0 = is_enum_v<E>, e1 = is_scoped_enum_v<E> }; static_assert( e0 ); static_assert( ! e1 ); } Compiled with -std=gnu++20: e.C: In instantiation of 'struct remove_const<f()::E>': e.C:3:28: required by substitution of 'template<class T> using remove_const_t = typename remove_const::type [with T = f()::E]' e.C:15:26: required by substitution of 'template<class T> requires (is_enum_v<T>) && requires(typename remove_const<T>::type t) {t = t;} struct is_scoped_enum<T> [with T = f()::E]' e.C:22:61: required from 'constexpr const bool is_scoped_enum_v<f()::E>' e.C:26:36: required from here e.C:1:29: error: enum value type is not 'INTEGER_TYPE' nor convertible to the enum 1 | template<typename T> struct remove_const { using type = T; }; | ^~~~~~~~~~~~ <const_decl 0x7fcf7f625070 e0 type <boolean_type 0x7fcf7f4c1b28 bool public unsigned type_6 QI size <integer_cst 0x7fcf7f4a3fa8 constant 8> unit-size <integer_cst 0x7fcf7f4a3fc0 constant 1> align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fcf7f4c1b28 precision:1 min <integer_cst 0x7fcf7f4c4210 0> max <integer_cst 0x7fcf7f4c4240 1>> readonly constant VOID e.C:26:12 align:1 warn_if_not_align:0 context <enumeral_type 0x7fcf7f61cf18 E> initial <integer_cst 0x7fcf7f4c4240 1> chain <type_decl 0x7fcf7f61f7b8 E>> <identifier_node 0x7fcf7f61b900 e0 normal local bindings <(nil)>> <enumeral_type 0x7fcf7f61cf18 E type_6 VOID align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fcf7f61cf18 precision:0 values <tree_list 0x7fcf7f61de88 purpose <identifier_node 0x7fcf7f61b900 e0 normal local bindings <(nil)>> value <const_decl 0x7fcf7f625070 e0 type <boolean_type 0x7fcf7f4c1b28 bool> readonly constant VOID e.C:26:12 align:1 warn_if_not_align:0 context <enumeral_type 0x7fcf7f61cf18 E> initial <integer_cst 0x7fcf7f4c4240 1> chain <type_decl 0x7fcf7f61f7b8 E>>> context <function_decl 0x7fcf7f608d00 f> chain <type_decl 0x7fcf7f61f7b8 E>> e.C:1:29: internal compiler error: 'verify_type' failed 0x1385d10 verify_type(tree_node const*) /home/jwakely/src/gcc/gcc/gcc/tree.c:14926 0xcdd13d gen_type_die_with_usage /home/jwakely/src/gcc/gcc/gcc/dwarf2out.c:25731 0xcdeaa6 gen_type_die /home/jwakely/src/gcc/gcc/gcc/dwarf2out.c:25962 0xcdf01c modified_type_die /home/jwakely/src/gcc/gcc/gcc/dwarf2out.c:13727 0xce29f1 add_type_attribute /home/jwakely/src/gcc/gcc/gcc/dwarf2out.c:21910 0xcf78da gen_typedef_die /home/jwakely/src/gcc/gcc/gcc/dwarf2out.c:25638 0xcf78da gen_typedef_die /home/jwakely/src/gcc/gcc/gcc/dwarf2out.c:25572 0xcd9f8a gen_decl_die /home/jwakely/src/gcc/gcc/gcc/dwarf2out.c:26604 0xcdc18d gen_member_die /home/jwakely/src/gcc/gcc/gcc/dwarf2out.c:25415 0xcdc18d gen_struct_or_union_type_die /home/jwakely/src/gcc/gcc/gcc/dwarf2out.c:25511 0xcdc18d gen_tagged_type_die /home/jwakely/src/gcc/gcc/gcc/dwarf2out.c:25712 0xcdd42a gen_tagged_type_die /home/jwakely/src/gcc/gcc/gcc/dwarf2out.c:25666 0xcdd42a gen_type_die_with_usage /home/jwakely/src/gcc/gcc/gcc/dwarf2out.c:25907 0xcdeaa6 gen_type_die /home/jwakely/src/gcc/gcc/gcc/dwarf2out.c:25962 0xcd9a52 gen_decl_die /home/jwakely/src/gcc/gcc/gcc/dwarf2out.c:26601 0xcdac53 dwarf2out_decl /home/jwakely/src/gcc/gcc/gcc/dwarf2out.c:27156 0xcdb1e1 dwarf2out_type_decl /home/jwakely/src/gcc/gcc/gcc/dwarf2out.c:26874 0xcdb1e1 dwarf2out_type_decl /home/jwakely/src/gcc/gcc/gcc/dwarf2out.c:26869 0xfc7994 rest_of_type_compilation(tree_node*, int) /home/jwakely/src/gcc/gcc/gcc/passes.c:339 0x8fdc63 finish_struct_1(tree_node*) /home/jwakely/src/gcc/gcc/gcc/cp/class.c:7548 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions.
next reply other threads:[~2021-04-08 10:37 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-08 10:37 redi at gcc dot gnu.org [this message] 2021-04-08 10:38 ` [Bug c++/99968] " redi at gcc dot gnu.org 2021-04-08 10:58 ` redi at gcc dot gnu.org 2021-04-08 11:00 ` [Bug c++/99968] [10/11 " mpolacek at gcc dot gnu.org 2021-04-08 11:06 ` [Bug c++/99968] " redi at gcc dot gnu.org 2021-04-08 11:09 ` cvs-commit at gcc dot gnu.org 2021-04-08 11:11 ` mpolacek at gcc dot gnu.org 2021-04-09 13:59 ` ppalka at gcc dot gnu.org 2021-04-09 14:01 ` ppalka at gcc dot gnu.org 2021-12-12 6:39 ` pinskia at gcc dot gnu.org 2021-12-28 4:52 ` jason at gcc dot gnu.org 2021-12-28 17:46 ` cvs-commit at gcc dot gnu.org 2022-09-01 10:50 ` redi at gcc dot gnu.org 2022-09-01 14:48 ` cvs-commit at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-99968-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).