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

            Bug ID: 93286
           Summary: [10 Regression] ICE: tree check: did not expect class
                    ‘type’, have ‘type’ (reference_type) in
                    convert_from_reference, at cp/cvt.c:550 since
                    g:e0d91792eec490d1
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: edlinger at gcc dot gnu.org
  Target Milestone: ---

I see the following ICE:

$ cat effect.ii
template <bool> using __bool_constant = struct A;
template <typename... _Args>
struct B : __bool_constant<__is_constructible(int, _Args...)> {};
template <bool> using enable_if_t = int;
template <typename... _Args> bool is_constructible_v = B<_Args...>::value;
class C {
  template <typename _Tp, typename = enable_if_t<is_constructible_v<_Tp>>>
  C(_Tp &&);
};
using Effect_t = C;
void fn1(Effect_t effect) {
  [](int &effect) {};
}

$ g++ -fmax-errors=1 -std=c++17 effect.ii -c
effect.ii: In instantiation of ‘struct B<int&&>’:
effect.ii:5:35:   required from ‘bool is_constructible_v<int&&>’
effect.ii:7:50:   required by substitution of ‘template<class _Tp, class>
C::C(_Tp&&) [with _Tp = int&&; <template-parameter-1-2> = <missing>]’
effect.ii:12:17:   required from here
effect.ii:3:28: internal compiler error: tree check: did not expect class
‘type’, have ‘type’ (reference_type) in convert_from_reference, at cp/cvt.c:550
    3 | struct B : __bool_constant<__is_constructible(int, _Args...)> {};
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x18ae642 tree_not_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        /home/marxin/Programming/gcc/gcc/tree.c:9784
0x9cbb02 non_type_check(tree_node*, char const*, int, char const*)
        /home/marxin/Programming/gcc/gcc/tree.h:3457
0xa5747b convert_from_reference(tree_node*)
        /home/marxin/Programming/gcc/gcc/cp/cvt.c:550
0xc59671 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:19865
0xc5b1cd tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:20164
0xc53012 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:18515
0xc2f384 tsubst_template_arg(tree_node*, tree_node*, int, tree_node*)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:12069
0xc3306e tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:13136
0xc4125f tsubst(tree_node*, tree_node*, int, tree_node*)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:15388
0xc3f305 tsubst(tree_node*, tree_node*, int, tree_node*)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:14988
0xc2d32c instantiate_class_template_1
        /home/marxin/Programming/gcc/gcc/cp/pt.c:11639
0xc2f2da instantiate_class_template(tree_node*)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:12051
0xcf9f6b complete_type(tree_node*)
        /home/marxin/Programming/gcc/gcc/cp/typeck.c:137
0xc9717f lookup_member(tree_node*, tree_node*, int, bool, int,
access_failure_info*)
        /home/marxin/Programming/gcc/gcc/cp/search.c:1129
0xb7b010 lookup_qualified_name(tree_node*, tree_node*, int, bool, bool)
        /home/marxin/Programming/gcc/gcc/cp/name-lookup.c:6009
0xc435cb tsubst_qualified_id
        /home/marxin/Programming/gcc/gcc/cp/pt.c:15980
0xc55c14 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:19184
0xc53012 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:18515
0xc43a3e tsubst_init
        /home/marxin/Programming/gcc/gcc/cp/pt.c:16067
0xc6de81 regenerate_decl_from_template
        /home/marxin/Programming/gcc/gcc/cp/pt.c:24819
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.

Reply via email to