public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100138] New: ICE with constructor constrained (C++20 Concepts) by parameter pack length
@ 2021-04-18 23:00 pkeir at outlook dot com
  2021-04-19  2:07 ` [Bug c++/100138] " ppalka at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: pkeir at outlook dot com @ 2021-04-18 23:00 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100138
           Summary: ICE with constructor constrained (C++20 Concepts) by
                    parameter pack length
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pkeir at outlook dot com
  Target Milestone: ---

Created attachment 50624
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50624&action=edit
The C++ file producing the ICE

Compiling the code below with `-c -std=c++20` produces an ICE. 

template <int N = 1>
struct Foo
{
  template <typename ...Ts>
  Foo(Ts... xs) requires(sizeof...(xs)==N) {}
};

void bar()
{
  Foo x{64};
}

As a workaround, using Ts rather than xs within the requires clause avoids the
ICE. The error message is below:

constrained_ctor.hpp: In substitution of ‘template<int N, class ... Ts> Foo(Ts
...)-> Foo<N> requires  sizeof ... ((Foo<N>::__ct ::xs ...)) == N [with int N =
1; Ts = {int}]’:
constrained_ctor.hpp:10:11:   required from here
constrained_ctor.hpp:5:26: internal compiler error: Segmentation fault
    5 |   Foo(Ts... xs) requires(sizeof...(xs)==N) {}
      |                          ^~~~~~~~~~~~~
0x10d0e8f crash_signal
        ../../gcc/toplev.c:327
0x950d49 hash_table<hash_map<tree_node*, tree_node*,
simple_hashmap_traits<default_hash_traits<tree_node*>, tree_node*>
>::hash_entry, false, xcallocator>::find_slot_with_hash(tree_node* const&,
unsigned int, insert_option)
        ../../gcc/hash-table.h:963
0xac055d hash_map<tree_node*, tree_node*,
simple_hashmap_traits<default_hash_traits<tree_node*>, tree_node*>
>::put(tree_node* const&, tree_node* const&)
        ../../gcc/hash-map.h:166
0xac055d register_local_specialization(tree_node*, tree_node*)
        ../../gcc/cp/pt.c:2004
0xad21e1 gen_elem_of_pack_expansion_instantiation
        ../../gcc/cp/pt.c:12496
0xad21e1 tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.c:13173
0xac63be tsubst_copy
        ../../gcc/cp/pt.c:16925
0xac7ca4 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc/cp/pt.c:20896
0xac7ad3 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc/cp/pt.c:19856
0xad3128 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/cp/pt.c:19144
0x95a455 satisfy_atom
        ../../gcc/cp/constraint.cc:2984
0x95a455 satisfy_constraint_r
        ../../gcc/cp/constraint.cc:3047
0x95a779 satisfy_normalized_constraints
        ../../gcc/cp/constraint.cc:3069
0x957d7e satisfy_declaration_constraints
        ../../gcc/cp/constraint.cc:3277
0x957d7e constraint_satisfaction_value
        ../../gcc/cp/constraint.cc:3297
0x95a810 constraints_satisfied_p(tree_node*, tree_node*)
        ../../gcc/cp/constraint.cc:3334
0xaf98a5 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
        ../../gcc/cp/pt.c:21632
0x9053fd add_template_candidate_real
        ../../gcc/cp/call.c:3456
0x905eda add_template_candidate
        ../../gcc/cp/call.c:3541
0x905eda add_candidates
        ../../gcc/cp/call.c:6031
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.

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

end of thread, other threads:[~2021-07-16 22:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-18 23:00 [Bug c++/100138] New: ICE with constructor constrained (C++20 Concepts) by parameter pack length pkeir at outlook dot com
2021-04-19  2:07 ` [Bug c++/100138] " ppalka at gcc dot gnu.org
2021-05-06 15:37 ` ppalka at gcc dot gnu.org
2021-05-11  2:39 ` cvs-commit at gcc dot gnu.org
2021-07-16 22:49 ` cvs-commit at gcc dot gnu.org
2021-07-16 22:51 ` ppalka 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).