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

            Bug ID: 68827
           Summary: [concepts] ICE in fold where requires parameter
                    shadows function argument
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jarrydb at cse dot unsw.edu.au
  Target Milestone: ---

The following code causes an ICE in r231384

template <typename... Types>
struct Var
{
};

struct A
{
};

template <typename V, typename... Types, typename... Args>
bool requires_types_args(V&& v, Var<Types...>&, Args&&... args)
{
  return (true && ... &&
    requires (V&& v, Types... type, Args... args) {
      foo(v, type, args...);
    }
  );
}

void bar()
{
  Var<int, char> v;
  requires_types_args(A(), v, 1, 'b');
}


g++ -std=c++1z fold-ice2.cpp -c
fold-ice2.cpp: In instantiation of ‘bool requires_types_args(V&&, Var<Types
...>&, Args&& ...) [with V = A; Types = {int, char}; Args = {int, char}]’:
fold-ice2.cpp:23:37:   required from here
fold-ice2.cpp:15:10: internal compiler error: in arg_assoc_type, at
cp/name-lookup.c:5570
       foo(v, type, args...);
       ~~~^~~~~~~~~~~~~~~~~~

0x7dd593 arg_assoc_type
        ../../../src/gcc-git/gcc/cp/name-lookup.c:5570
0x7ddea1 arg_assoc_args_vec
        ../../../src/gcc-git/gcc/cp/name-lookup.c:5596
0x7ddea1 lookup_arg_dependent_1
        ../../../src/gcc-git/gcc/cp/name-lookup.c:5701
0x7ddea1 lookup_arg_dependent(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>*)
        ../../../src/gcc-git/gcc/cp/name-lookup.c:5729
0x77c429 perform_koenig_lookup(cp_expr, vec<tree_node*, va_gc, vl_embed>*, int)
        ../../../src/gcc-git/gcc/cp/semantics.c:2215
0x650ef5 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../../src/gcc-git/gcc/cp/pt.c:16353
0x6451ac tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../../src/gcc-git/gcc/cp/pt.c:15628
0x82133c tsubst_simple_requirement
        ../../../src/gcc-git/gcc/cp/constraint.cc:1580
0x82133c tsubst_requirement
        ../../../src/gcc-git/gcc/cp/constraint.cc:1636
0x82133c tsubst_requirement_body
        ../../../src/gcc-git/gcc/cp/constraint.cc:1659
0x82133c tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*)
        ../../../src/gcc-git/gcc/cp/constraint.cc:1690
0x64f690 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../../src/gcc-git/gcc/cp/pt.c:16980
0x6451ac tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../../src/gcc-git/gcc/cp/pt.c:15628
0x6617ad tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
        ../../../src/gcc-git/gcc/cp/pt.c:10919
0x64b69c tsubst_fold_expr_pack
        ../../../src/gcc-git/gcc/cp/pt.c:10604
0x64b69c tsubst_binary_left_fold
        ../../../src/gcc-git/gcc/cp/pt.c:10661
0x64b69c tsubst_copy
        ../../../src/gcc-git/gcc/cp/pt.c:14303
0x650248 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../../src/gcc-git/gcc/cp/pt.c:16058
0x6451ac tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../../src/gcc-git/gcc/cp/pt.c:15628
0x644457 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../../src/gcc-git/gcc/cp/pt.c:14940
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

Reply via email to